PlaneUtil
Index
Constructors
constructor
Returns PlaneUtil
Methods
publicstaticcameraScaledSize
Gives a size on a plane that scales with the distance of the camera.
Parameters
center: Vertex3
Point on the plane infront of the camera.
camera: Camera
Camera to use when scaling.
scale: number
Number to scale the size with.
Returns number
The camera scaled size.
publicstaticcameraScaledSquareOnPlaneToRef
Given a center point on the plane calculate 4 points in the shape of a square (on plane) where sides have size
scale
.Type parameters
- T: Vertex3
Parameters
center: Vertex3
Center of resulting square.
normal: Vertex3
Normal of plane that square will be generated on.
camera: Camera
Camera used to scale square.
scale: number
Square size.
dst: [T, T, T, T]
Square corner points.
Returns [T, T, T, T]
dst
publicstaticcameraScaledSquareWithParentOnPlaneToRef
Given a center point on the plane calculate 4 points in the shape of a square (on plane) where sides have size
scale
then convert the coordinates to the parent transforms coordinate system.Type parameters
- T: Vertex3
Parameters
center: Vertex3
Center of resulting square.
normal: Vertex3
Normal of plane that square will be generated on.
camera: Camera
Camera used to scale square.
scale: number
Square size.
parent: TransformNode
The parent TransformNode, this transform nodes world matrix will be used to transform the coordinates to local space.
dst: [T, T, T, T]
Square corner points.
Returns [T, T, T, T]
dst
publicstaticcreatePlaneFromCamera
Creates a plane aligned with the current camera, and a size that can be used to place points on the plane from center that reaches the edges of the camera frustum
Parameters
center: Vertex3
A point of the plane
normal: Vertex3
The normal of the plane
camera: Camera
The camera with which size should be scaled with to reach the edges of the frustum
scale: number
Number to scale the returned size with.
Returns { plane: Plane; size: number }
An object containing the newly created plane, and the size to move things away from the center in order to put them on the camera frustum edges
plane: Plane
size: number
publicstaticdoesPointsLieInPlane
Validate that a set of given points lie in the provided plane.
Parameters
plane: Plane
Plane to check against.
points: Vertex3[]
Array containing points to validate.
Returns boolean
true
if points lie in plane,false
otherwise.
publicstaticplanesIntersect
Finds the intersection area of two axis aligned planes and returns it as 2 points.
Parameters
center1: Vector3
scale1: Vector3
center2: Vector3
Center of second plane.
scale2: Vector3
Scale of second plane.
Returns undefined | Vector3[]
The intersection area of the 2 planes. undefined if there is none.
publicstaticpointOnPlaneToRef
Calculate a point on
plane
located at an angle oftheta
around point, P, on plane that is closest to (0,0,0).Type parameters
- T: Vertex3
Parameters
plane: Plane
theta: number
Angle in radians in unit circle projected on plane around point P on plane closest to (0,0,0).
dst: T
Point on plane is written to this object. Point is located on unit circle project on plane around point P closest to (0,0,0).
Returns T
Reference to
dst
publicstaticsquareOnPlaneToRef
Given a center point on the plane calculate 4 points in the shape of a square (on plane) where sides have size
size
.Type parameters
- T: Vertex3
Parameters
plane: Plane
centerOnPlane: Vertex3
Center of square must lie on plane
size: number
Size of sides of square.
dst: [T, T, T, T]
4 corners of the calculated square is written to these objects.
Returns [T, T, T, T]
Reference to
dst
Useful operations to perform on a plane.