UNPKG

2.26 kBTypeScriptView Raw
1import { BufferGeometry } from "../core/BufferGeometry.js";
2
3/**
4 * {@link CircleGeometry} is a simple shape of Euclidean geometry
5 * @remarks
6 * It is constructed from a number of triangular segments that are oriented around a central point and extend as far out as a given radius
7 * It is built counter-clockwise from a start angle and a given central angle
8 * It can also be used to create regular polygons, where the number of segments determines the number of sides.
9 * @example
10 * ```typescript
11 * const geometry = new THREE.CircleGeometry(5, 32);
12 * const material = new THREE.MeshBasicMaterial({
13 * color: 0xffff00
14 * });
15 * const circle = new THREE.Mesh(geometry, material);
16 * scene.add(circle);
17 * ```
18 * @see {@link https://threejs.org/docs/index.html#api/en/geometries/CircleGeometry | Official Documentation}
19 * @see {@link https://github.com/mrdoob/three.js/blob/master/src/geometries/CircleGeometry.js | Source}
20 */
21export class CircleGeometry extends BufferGeometry {
22 /**
23 * Create a new instance of {@link CircleGeometry}
24 * @param radius Radius of the circle. Expects a `Float`. Default `1`
25 * @param segments Number of segments (triangles). Expects a `Integer`. Minimum `3`. Default `32`
26 * @param thetaStart Start angle for first segment. Expects a `Float`. Default `0`, _(three o'clock position)_.
27 * @param thetaLength The central angle, often called theta, of the circular sector. Expects a `Float`. Default `Math.PI * 2`, _which makes for a complete circle_.
28 */
29 constructor(radius?: number, segments?: number, thetaStart?: number, thetaLength?: number);
30
31 /**
32 * A Read-only _string_ to check if `this` object type.
33 * @remarks Sub-classes will update this value.
34 * @defaultValue `CircleGeometry`
35 */
36 override readonly type: string | "CircleGeometry";
37
38 /**
39 * An object with a property for each of the constructor parameters.
40 * @remarks Any modification after instantiation does not change the geometry.
41 */
42 readonly parameters: {
43 readonly radius: number;
44 readonly segments: number;
45 readonly thetaStart: number;
46 readonly thetaLength: number;
47 };
48
49 /** @internal */
50 static fromJSON(data: {}): CircleGeometry;
51}