-
Notifications
You must be signed in to change notification settings - Fork 1
/
Plane.d.ts
159 lines (159 loc) · 5.87 KB
/
Plane.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
import { Matrix3 } from './Matrix3';
import { Vector3 } from './Vector3';
import { Sphere } from './Sphere';
import { Line3 } from './Line3';
import { Box3 } from './Box3';
import { Matrix4 } from './Matrix4';
import { Base } from './Base';
/**
* A two dimensional surface that extends infinitely in 3d space,
* represented in Hessian normal form by a unit length normal
* vector and a constant.
*/
export declare class Plane extends Base {
normal: Vector3;
constant: number;
/**
* Create a new instance.
* @param normal - (optional) a unit length Vector3 defining the normal of the plane. Default is (1, 0, 0).
* @param constant - (optional) the signed distance from the origin to the plane. Default is 0.
*/
constructor(normal?: Vector3, constant?: number);
/**
* Read-only flag to check if a given object is of type Plane.
*/
get isPlane(): boolean;
/**
* Sets this plane's normal and constant properties by copying
* the values from the given normal.
* @param normal - a unit length Vector3 defining the normal of the plane.
* @param constant - the signed distance from the origin to the plane. Default is 0.
* @returns This instance.
*/
set(normal: Vector3, constant: number): this;
/**
* Set the individual components that define the plane.
* @param x - x value of the unit length normal vector.
* @param y - y value of the unit length normal vector.
* @param z - z value of the unit length normal vector.
* @param w - the value of the plane's constant property.
* @returns This instance.
*/
setComponents(x: number, y: number, z: number, w: number): this;
/**
* Sets the plane's properties as defined by a normal and an arbitrary coplanar point.
* @param normal - a unit length Vector3 defining the normal of the plane.
* @param point - a Vector3 point
* @returns This instance.
*/
setFromNormalAndCoplanarPoint(normal: Vector3, point: Vector3): this;
/**
* Defines the plane based on the 3 provided points.
* The winding order is assumed to be counter-clockwise,
* and determines the direction of the normal.
* @param a - first point on the plane.
* @param b - secpmd point on the plane.
* @param c - third point on the plane.
* @returns This instance.
*/
setFromCoplanarPoints(a: Vector3, b: Vector3, c: Vector3): this;
/**
* Copies the values of the passed plane's normal and constant properties to this plane.
* @param plane - The source plane to copy values from.
* @returns This instance.
*/
copy(plane: Plane): this;
/**
* Normalizes the normal vector, and adjusts the constant value accordingly.
* @returns This instance.
*/
normalize(): this;
/**
* Negates both the normal vector and the constant.
* @returns This instance.
*/
negate(): this;
/**
* Compute the signed distance from the point to the plane.
* @param point - The point to measure to.
* @returns The signed distance value.
*/
distanceToPoint(point: Vector3): number;
/**
* Compute the signed distance from the sphere to the plane.
* @param sphere - The sphere surface to measure to.
* @returns The signed distance value.
*/
distanceToSphere(sphere: Sphere): number;
/**
* Projects a point onto the plane.
* @param point - the Vector3 to project onto the plane.
* @param target - the result will be copied into this Vector3.
* @returns The projected point.
*/
projectPoint(point: Vector3, target: Vector3): Vector3;
/**
* Compute the intersection point of the passed line and the plane.
* @param line - the Line3 to check for intersection.
* @param target — the result will be copied into this Vector3.
* @returns null if the line does not intersect; otherwise returns the
* line's starting point if the line is coplanar with the plane.
*/
intersectLine(line: Line3, target: Vector3): Vector3 | null;
/**
* Tests whether a line segment intersects with (passes through) the plane.
* @param line - the Line3 to check for intersection.
* @returns True if the line intersect this plane.
*/
intersectsLine(line: Line3): boolean;
/**
* Determines whether or not this plane intersects box.
* @param box - the Box3 to check for intersection.
* @returns True if box and this plane intersect.
*/
intersectsBox(box: Box3): boolean;
/**
* Determines whether or not this plane intersects a sphere.
* @param sphere - the Sphere to check for intersection.
* @returns True if sphere and this plane intersect.
*/
intersectsSphere(sphere: Sphere): boolean;
/**
* Compute a Vector3 coplanar to the plane, by calculating
* the projection of the normal vector at the origin onto the plane.
* @param target — The result will be copied into this Vector3.
* @returns A vector coplanar to this plane.
*/
coplanarPoint(target: Vector3): Vector3;
/**
* Apply a Matrix4 to the plane. The matrix must be an affine,
* homogeneous transform.If supplying an optionalNormalMatrix,
* it can be created like so:
* ```
* const optionalNormalMatrix = new Matrix3().getNormalMatrix( matrix );
* ```
* @param matrix - the Matrix4 to apply.
* @param optionalNormalMatrix
* @returns This instance
*/
applyMatrix4(matrix: Matrix4, optionalNormalMatrix?: Matrix3): this;
/**
* Translates the plane by the distance defined by the offset vector.
* Note that this only affects the plane constant and will not
* affect the normal vector.
* @param offset - the amount to move the plane by.
* @returns This instance.
*/
translate(offset: Vector3): this;
/**
* Checks to see if two planes are equal (their normal and constant properties match).
* @param plane - The plane to compare with.
* @returns True if value-wise equal.
*/
equals(plane: Plane): boolean;
/**
* Create a new plane with the same normal and constant as this one.
* @returns The enw instance.
*/
clone(): Plane;
}