newton.utils.create_sphere_mesh#
- newton.utils.create_sphere_mesh(radius=1.0, num_latitudes=default_num_segments, num_longitudes=default_num_segments, reverse_winding=False)[source]#
Create a sphere mesh with specified parameters.
Generates vertices and triangle indices for a UV sphere using latitude/longitude parametrization. Each vertex contains position, normal, and UV coordinates.
- Parameters:
radius (float) – Sphere radius. Defaults to 1.0.
num_latitudes (int) – Number of horizontal divisions (latitude lines). Defaults to default_num_segments.
num_longitudes (int) – Number of vertical divisions (longitude lines). Defaults to default_num_segments.
reverse_winding (bool) – If True, reverses triangle winding order. Defaults to False.
- Returns:
- A tuple containing:
vertices (np.ndarray): Float32 array of shape (N, 8) where each vertex contains [x, y, z, nx, ny, nz, u, v] (position, normal, UV coords).
indices (np.ndarray): Uint32 array of triangle indices for rendering.
- Return type:
tuple[np.ndarray, np.ndarray]