TorusGeometry
TorusGeometry ⟵ BufferGeometry
A geometry class for a torus (donut) with given radius, tube and
segment counts.
TorusGeometry creates a torus geometry that is centered on the origin,
with the torus ring lying in the XZ plane and the tube cross-section
extending along the Y axis. This provides a classic donut shape.
Methods
TorusGeometry(f32 radius, f32 tube, u32 radialSegments, u32 tubularSegments, f32 arc, const Color& color)
Universal constructor - covers all cases with smart defaults
| radius | Major radius (center to tube center) | 1.0f |
| tube | Tube radius (must be smaller than radius) | 0.4f |
| radialSegments | Segments around the tube cross-section | 12 |
| tubularSegments | Segments around the torus ring | 48 |
| arc | Central sweep angle in radians | 2π |
| color | RGBA color for all vertices | 0xFFFFFFFF |
TorusGeometry* clone(bool recursive = false) const
Creates a copy of this geometry
| recursive | Whether to clone descendants as well |
void copy(const TorusGeometry& geometry)
Copies properties from another geometry
| geometry | Source geometry to copy from |
void buildTorus()
Builds the torus geometry with vertices, indices, and colors
Properties
| arc | f32 | Central sweep angle in radians |
| color | Color | RGBA color for all vertices |
| radialSegments | u32 | Number of segments around tube |
| radius | f32 | Major radius of the torus |
| tube | f32 | Radius of the tube |
| tubularSegments | u32 | Number of segments around ring |