1 | import { BufferGeometry } from "../core/BufferGeometry.js";
|
2 |
|
3 | /**
|
4 | * A class for generating cylinder geometries.
|
5 | * @example
|
6 | * ```typescript
|
7 | * const geometry = new THREE.CylinderGeometry(5, 5, 20, 32);
|
8 | * const material = new THREE.MeshBasicMaterial({
|
9 | * color: 0xffff00
|
10 | * });
|
11 | * const cylinder = new THREE.Mesh(geometry, material);
|
12 | * scene.add(cylinder);
|
13 | * ```
|
14 | * @see {@link https://threejs.org/docs/index.html#api/en/geometries/CylinderGeometry | Official Documentation}
|
15 | * @see {@link https://github.com/mrdoob/three.js/blob/master/src/geometries/CylinderGeometry.js | Source}
|
16 | */
|
17 | export class CylinderGeometry extends BufferGeometry {
|
18 | /**
|
19 | * Create a new instance of {@link CylinderGeometry}
|
20 | * @param radiusTop Radius of the cylinder at the top. Default `1`
|
21 | * @param radiusBottom Radius of the cylinder at the bottom. Default `1`
|
22 | * @param height Height of the cylinder. Default `1`
|
23 | * @param radialSegments Number of segmented faces around the circumference of the cylinder. Default `32`
|
24 | * @param heightSegments Number of rows of faces along the height of the cylinder. Expects a `Integer`. Default `1`
|
25 | * @param openEnded A Boolean indicating whether the ends of the cylinder are open or capped. Default `false`, _meaning capped_.
|
26 | * @param thetaStart Start angle for first segment. Default `0`, _(three o'clock position)_.
|
27 | * @param thetaLength The central angle, often called theta, of the circular sector. Default `Math.PI * 2`, _which makes for a complete cylinder.
|
28 | */
|
29 | constructor(
|
30 | radiusTop?: number,
|
31 | radiusBottom?: number,
|
32 | height?: number,
|
33 | radialSegments?: number,
|
34 | heightSegments?: number,
|
35 | openEnded?: boolean,
|
36 | thetaStart?: number,
|
37 | thetaLength?: number,
|
38 | );
|
39 |
|
40 | /**
|
41 | * A Read-only _string_ to check if `this` object type.
|
42 | * @remarks Sub-classes will update this value.
|
43 | * @defaultValue `CylinderGeometry`
|
44 | */
|
45 | override readonly type: string | "CylinderGeometry";
|
46 |
|
47 | /**
|
48 | * An object with a property for each of the constructor parameters.
|
49 | * @remarks Any modification after instantiation does not change the geometry.
|
50 | */
|
51 | readonly parameters: {
|
52 | readonly radiusTop: number;
|
53 | readonly radiusBottom: number;
|
54 | readonly height: number;
|
55 | readonly radialSegments: number;
|
56 | readonly heightSegments: number;
|
57 | readonly openEnded: boolean;
|
58 | readonly thetaStart: number;
|
59 | readonly thetaLength: number;
|
60 | };
|
61 |
|
62 | /** @internal */
|
63 | static fromJSON(data: any): CylinderGeometry;
|
64 | }
|