UNPKG

1.57 kBTypeScriptView Raw
1import { Plane } from "../math/Plane.js";
2import { LineSegments } from "../objects/LineSegments.js";
3
4/**
5 * Helper object to visualize a {@link THREE.Plane | Plane}.
6 * @example
7 * ```typescript
8 * const plane = new THREE.Plane(new THREE.Vector3(1, 1, 0.2), 3);
9 * const helper = new THREE.PlaneHelper(plane, 1, 0xffff00);
10 * scene.add(helper);
11 * ```
12 * @see {@link https://threejs.org/docs/index.html#api/en/helpers/PlaneHelper | Official Documentation}
13 * @see {@link https://github.com/mrdoob/three.js/blob/master/src/helpers/PlaneHelper.js | Source}
14 */
15export class PlaneHelper extends LineSegments {
16 /**
17 * Creates a new wireframe representation of the passed plane.
18 * @param plane The plane to visualize.
19 * @param size Side length of plane helper. Expects a `Float`. Default `1`
20 * @param hex Color. Default `0xffff00`
21 */
22 constructor(plane: Plane, size?: number, hex?: number);
23
24 /**
25 * A Read-only _string_ to check if `this` object type.
26 * @remarks Sub-classes will update this value.
27 * @override
28 * @defaultValue `PlaneHelper`
29 */
30 override readonly type: string | "PlaneHelper";
31
32 /**
33 * The {@link Plane | plane} being visualized.
34 */
35 plane: Plane;
36
37 /**
38 * The side lengths of plane helper.
39 * @remarks Expects a `Float`
40 * @defaultValue `1`
41 */
42 size: number;
43
44 /**
45 * Frees the GPU-related resources allocated by this instance
46 * @remarks
47 * Call this method whenever this instance is no longer used in your app.
48 */
49 dispose(): void;
50}