newton.utils.create_cone_mesh#

newton.utils.create_cone_mesh(radius, half_height, up_axis=1, segments=default_num_segments)[source]#

Create a cone mesh with circular base and pointed top.

Generates vertices and triangle indices for a cone shape. Implemented as a cylinder with zero top radius to ensure correct normal calculations.

Parameters:
  • radius (float) – Radius of the cone’s circular base.

  • half_height (float) – Half the total height of the cone (distance from center to tip/base).

  • up_axis (int) – Axis along which the cone extends (0=X, 1=Y, 2=Z). Defaults to 1 (Y-axis).

  • segments (int) – Number of segments around the circumference. Defaults to default_num_segments.

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]