UNPKG

2.29 kBTypeScriptView Raw
1import { BufferGeometry } from "../core/BufferGeometry.js";
2import { Vector2 } from "../math/Vector2.js";
3
4/**
5 * Creates meshes with axial symmetry like vases
6 * @remarks
7 * The lathe rotates around the Y axis.
8 * @example
9 * ```typescript
10 * const points = [];
11 * for (let i = 0; i & lt; 10; i++) {
12 * points.push(new THREE.Vector2(Math.sin(i * 0.2) * 10 + 5, (i - 5) * 2));
13 * }
14 * const geometry = new THREE.LatheGeometry(points);
15 * const material = new THREE.MeshBasicMaterial({
16 * color: 0xffff00
17 * });
18 * const lathe = new THREE.Mesh(geometry, material);
19 * scene.add(lathe);
20 * ```
21 * @see {@link https://threejs.org/docs/index.html#api/en/geometries/LatheGeometry | Official Documentation}
22 * @see {@link https://github.com/mrdoob/three.js/blob/master/src/geometries/LatheGeometry.js | Source}
23 */
24export class LatheGeometry extends BufferGeometry {
25 /**
26 * This creates a {@link LatheGeometry} based on the parameters.
27 * @param points Array of Vector2s. The x-coordinate of each point must be greater than zero.
28 * Default `[new Vector2(0, -0.5), new Vector2(0.5, 0), new Vector2(0, 0.5)]` _which creates a simple diamond shape_.
29 * @param segments The number of circumference segments to generate. Expects a `Integer`. Default `12`.
30 * @param phiStart The starting angle in radians. Expects a `Float`. Default `0`.
31 * @param phiLength The radian (0 to 2*PI) range of the lathed section 2*PI is a closed lathe, less than 2PI is a portion. Expects a `Float`. Default `Math.PI * 2`.
32 */
33 constructor(points?: Vector2[], segments?: number, phiStart?: number, phiLength?: number);
34
35 /**
36 * A Read-only _string_ to check if `this` object type.
37 * @remarks Sub-classes will update this value.
38 * @defaultValue `LatheGeometry`
39 */
40 override readonly type: string | "LatheGeometry";
41
42 /**
43 * An object with a property for each of the constructor parameters.
44 * @remarks Any modification after instantiation does not change the geometry.
45 */
46 readonly parameters: {
47 readonly points: Vector2[];
48 readonly segments: number;
49 readonly phiStart: number;
50 readonly phiLength: number;
51 };
52
53 /** @internal */
54 static fromJSON(data: {}): LatheGeometry;
55}