UNPKG

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