UNPKG

1.9 kBTypeScriptView Raw
1import { BufferGeometry } from "../core/BufferGeometry.js";
2
3/**
4 * A class for generating torus geometries.
5 * @example
6 * ```typescript
7 * const geometry = new THREE.TorusGeometry(10, 3, 16, 100);
8 * const material = new THREE.MeshBasicMaterial({
9 * color: 0xffff00
10 * });
11 * const torus = new THREE.Mesh(geometry, material);
12 * scene.add(torus);
13 * ```
14 * @see {@link https://threejs.org/docs/index.html#api/en/geometries/TorusGeometry | Official Documentation}
15 * @see {@link https://github.com/mrdoob/three.js/blob/master/src/geometries/TorusGeometry.js | Source}
16 */
17export class TorusGeometry extends BufferGeometry {
18 /**
19 * Create a new instance of {@link TorusGeometry}
20 * @param radius Radius of the torus, from the center of the torus to the center of the tube. Expects a `Float`. Default `1`.
21 * @param tube Radius of the tube. Expects a `Float`. Default `0.4`.
22 * @param radialSegments Expects a `Integer`.Default is `12`.
23 * @param tubularSegments Expects a `Integer`. Default `48`.
24 * @param arc Central angle. Expects a `Float`. Default `Math.PI * 2`
25 */
26 constructor(radius?: number, tube?: number, radialSegments?: number, tubularSegments?: number, arc?: number);
27
28 /**
29 * A Read-only _string_ to check if `this` object type.
30 * @remarks Sub-classes will update this value.
31 * @defaultValue `TorusGeometry`
32 */
33 override readonly type: string | "TorusGeometry";
34
35 /**
36 * An object with a property for each of the constructor parameters.
37 * @remarks Any modification after instantiation does not change the geometry.
38 */
39 readonly parameters: {
40 readonly radius: number;
41 readonly tube: number;
42 readonly radialSegments: number;
43 readonly tubularSegments: number;
44 readonly arc: number;
45 };
46
47 /** @internal */
48 static fromJSON(data: any): TorusGeometry;
49}