newton.utils.create_ellipsoid_mesh#

newton.utils.create_ellipsoid_mesh(rx=1.0, ry=1.0, rz=1.0, num_latitudes=default_num_segments, num_longitudes=default_num_segments, reverse_winding=False)[source]#

Create an ellipsoid mesh with specified semi-axes.

Generates vertices and triangle indices for a UV ellipsoid using latitude/longitude parametrization. Each vertex contains position, normal, and UV coordinates. The ellipsoid is centered at the origin with semi-axes along the X, Y, and Z axes.

Parameters:
  • rx (float) – Semi-axis length along the X direction. Defaults to 1.0.

  • ry (float) – Semi-axis length along the Y direction. Defaults to 1.0.

  • rz (float) – Semi-axis length along the Z direction. 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]