UNPKG

2.19 kBTypeScriptView Raw
1import { BufferGeometry } from "../core/BufferGeometry.js";
2
3/**
4 * A class for generating a two-dimensional ring geometry.
5 * @example
6 * ```typescript
7 * const geometry = new THREE.RingGeometry(1, 5, 32);
8 * const material = new THREE.MeshBasicMaterial({
9 * color: 0xffff00,
10 * side: THREE.DoubleSide
11 * });
12 * const mesh = new THREE.Mesh(geometry, material);
13 * scene.add(mesh);
14 * ```
15 * @see {@link https://threejs.org/docs/index.html#api/en/geometries/RingGeometry | Official Documentation}
16 * @see {@link https://github.com/mrdoob/three.js/blob/master/src/geometries/RingGeometry.js | Source}
17 */
18export class RingGeometry extends BufferGeometry {
19 /**
20 * Create a new instance of {@link RingGeometry}
21 * @param innerRadius Expects a `Float`. Default `0.5`.
22 * @param outerRadius Expects a `Float`. Default `1`.
23 * @param thetaSegments Number of segments. A higher number means the ring will be more round. Minimum is 3. Expects a `Integer`. Default `32`.
24 * @param phiSegments Number of segments per ring segment. Minimum is `1`. Expects a `Integer`. Default `1`.
25 * @param thetaStart Starting angle. Expects a `Float`. Default `0`.
26 * @param thetaLength Central angle. Expects a `Float`. Default `Math.PI * 2`.
27 */
28 constructor(
29 innerRadius?: number,
30 outerRadius?: number,
31 thetaSegments?: number,
32 phiSegments?: number,
33 thetaStart?: number,
34 thetaLength?: 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 `RingGeometry`
41 */
42 override readonly type: string | "RingGeometry";
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 innerRadius: number;
50 readonly outerRadius: number;
51 readonly thetaSegments: number;
52 readonly phiSegments: number;
53 readonly thetaStart: number;
54 readonly thetaLength: number;
55 };
56
57 /** @internal */
58 static fromJSON(data: {}): RingGeometry;
59}