1 | import { BufferGeometry } from "../core/BufferGeometry.js";
|
2 |
|
3 | /**
|
4 | * Creates a torus knot, the particular shape of which is defined by a pair of coprime integers, p and q
|
5 | * If p and q are not coprime, the result will be a torus link.
|
6 | * @example
|
7 | * ```typescript
|
8 | * const geometry = new THREE.TorusKnotGeometry(10, 3, 100, 16);
|
9 | * const material = new THREE.MeshBasicMaterial({
|
10 | * color: 0xffff00
|
11 | * });
|
12 | * const torusKnot = new THREE.Mesh(geometry, material);
|
13 | * scene.add(torusKnot);
|
14 | * ```
|
15 | * @see {@link https://threejs.org/docs/index.html#api/en/geometries/TorusKnotGeometry | Official Documentation}
|
16 | * @see {@link https://github.com/mrdoob/three.js/blob/master/src/geometries/TorusKnotGeometry.js | Source}
|
17 | */
|
18 | export class TorusKnotGeometry extends BufferGeometry {
|
19 | /**
|
20 | * Create a new instance of {@link TorusKnotGeometry}
|
21 | * @param radius Radius of the torus.. Default `1`.
|
22 | * @param tube Expects a `Float`. Default `0.4`.
|
23 | * @param tubularSegments Expects a `Integer`. Default `64`.
|
24 | * @param radialSegments Expects a `Integer`. Default `8`.
|
25 | * @param p This value determines, how many times the geometry winds around its axis of rotational symmetry. Expects a `Integer`. Default `2`.
|
26 | * @param q This value determines, how many times the geometry winds around a circle in the interior of the torus. Expects a `Integer`. Default `3`.
|
27 | */
|
28 | constructor(
|
29 | radius?: number,
|
30 | tube?: number,
|
31 | tubularSegments?: number,
|
32 | radialSegments?: number,
|
33 | p?: number,
|
34 | q?: number,
|
35 | );
|
36 |
|
37 | /**
|
38 | * A Read-only _string_ to check if `this` object type.
|
39 | * @remarks Sub-classes will update this value.
|
40 | * @defaultValue `TorusKnotGeometry`
|
41 | */
|
42 | override readonly type: string | "TorusKnotGeometry";
|
43 |
|
44 | /**
|
45 | * An object with a property for each of the constructor parameters.
|
46 | * @remarks Any modification after instantiation does not change the geometry.
|
47 | */
|
48 | readonly parameters: {
|
49 | readonly radius: number;
|
50 | readonly tube: number;
|
51 | readonly tubularSegments: number;
|
52 | readonly radialSegments: number;
|
53 | readonly p: number;
|
54 | readonly q: number;
|
55 | };
|
56 |
|
57 | /** @internal */
|
58 | static fromJSON(data: {}): TorusKnotGeometry;
|
59 | }
|