Skip to main content

PlaneUtil

Useful operations to perform on a plane.

Index

Constructors

constructor

Methods

publicstaticcameraScaledSize

  • cameraScaledSize(center: Vertex3, camera: Camera, scale: number): number
  • 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

  • cameraScaledSquareOnPlaneToRef<T>(center: Vertex3, normal: Vertex3, camera: Camera, scale: number, dst: [T, T, T, T]): [T, T, T, T]
  • 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

    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

  • cameraScaledSquareWithParentOnPlaneToRef<T>(center: Vertex3, normal: Vertex3, camera: Camera, scale: number, parent: TransformNode, dst: [T, T, T, T]): [T, T, T, T]
  • 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

    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

  • createPlaneFromCamera(center: Vertex3, normal: Vertex3, camera: Camera, scale: number): { plane: Plane; size: number }
  • 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

  • doesPointsLieInPlane(plane: Plane, points: Vertex3[]): boolean
  • 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

  • planesIntersect(center1: Vector3, scale1: Vector3, center2: Vector3, scale2: Vector3): undefined | Vector3[]
  • 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

  • pointOnPlaneToRef<T>(plane: Plane, theta: number, dst: T): T
  • Calculate a point on plane located at an angle of theta around point, P, on plane that is closest to (0,0,0).


    Type parameters

    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

  • squareOnPlaneToRef<T>(plane: Plane, centerOnPlane: Vertex3, size: number, dst: [T, T, T, T]): [T, T, T, T]
  • 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

    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