Plane
- class cee.Plane()
An immutable plane.
The class describes a plane by the equation: Ax + By + Cz + D = 0 The plane’s normal is defined by the coefficients [A, B, C]
Constructors
Methods
Constructors
constructor
- cee.Plane.constructor(A, B, C, D)
Constructor
- Arguments
A (
number
) –B (
number
) –C (
number
) –D (
number
) –
- Return type
cee.Plane
Accessors
- cee.Plane.A
The A coefficient of the plane equation
- cee.Plane.B
The B coefficient of the plane equation
- cee.Plane.C
The C coefficient of the plane equation
- cee.Plane.D
The D coefficient of the plane equation
Methods
equals
- cee.Plane.equals(other)
Returns true if the planes are equal.
- Arguments
other (
cee.PlaneLike
) –
- Return type
boolean
getDistance
- cee.Plane.getDistance(point)
Returns the distance between the give point and this plane
- Arguments
point (
cee.Vec3Like
) –
- Return type
number
getDistanceSquared
- cee.Plane.getDistanceSquared(point)
Returns the square of the distance from the point to the plane
- Arguments
point (
cee.Vec3Like
) –
- Return type
number
The square of the distance is relatively fast to compute (no ‘sqrt’) and is useful for determine which side the point is on. To obtain the actual distance, divide by sqrt(A^2 + B^2 + C^2) or use the distance() function directly.
getNormal
- cee.Plane.getNormal()
Returns the distance between the give point and this plane
- Return type
cee.Vec3Like
getPointInPlane
- cee.Plane.getPointInPlane()
Returns a point guaranteed to be on this plane
- Return type
cee.Vec3Like
projectPoint
- cee.Plane.projectPoint(point)
Project the given point onto the plane
- Arguments
point (
cee.Vec3Like
) –
- Return type
cee.Vec3Like
projectVector
- cee.Plane.projectVector(vector)
Project the given vector onto the plane
- Arguments
vector (
cee.Vec3Like
) –
- Return type
cee.Vec3Like
Returns the projected vector or undefined if the vector is parallel with the plane’s normal
from
- cee.Plane.from(plane)
Creates a plane instance from any object with A,B,C,D properties
- Arguments
plane (
cee.PlaneLike
) –
- Return type
cee.Plane
fromPointAndNormal
- cee.Plane.fromPointAndNormal(point, normal)
Returns a plane created from a point and a normal
- Arguments
point (
cee.Vec3Like
) –normal (
cee.Vec3Like
) –
- Return type
cee.Plane
fromPoints
- cee.Plane.fromPoints(p1, p2, p3)
Returns a plane created from three points
- Arguments
p1 (
cee.Vec3Like
) –p2 (
cee.Vec3Like
) –p3 (
cee.Vec3Like
) –
- Return type
cee.Plane
The three points cannot be on a line as they need to define a plane. So (p2 - p1)*(p3 - p1) != 0