Libraries.Compute.Plane Documentation

This class represents a plane. A plane is defined as a unit length normal and the distance from the origin.

Inherits from: Libraries.Language.Object

Variables Table

VariablesDescription
text onPlane
text back
text front

Actions Documentation

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.

Return

integer: The Compare result, Smaller, Equal, or Larger.

Example

``````Object o
Object t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)
``````

Distance(Libraries.Compute.Vector3 point)

This action returns the shortest distance from the plane and the passed point.

Return

number: the shortest distance between the point and plane

Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

Return

boolean: True if the hash codes are equal and false if they are not equal.

Example

``````use Libraries.Language.Object
use Libraries.Language.Types.Text
Object o
Text t
boolean result = o:Equals(t)
``````

GetDistance()

This action returns the distance of the plane from the origin.

Return

number: the distance of the plane from the origin

GetHashCode()

This action gets the hash code for an object.

Return

integer: The integer hash code of the object.

Example

``````Object o
integer hash = o:GetHashCode()
``````

GetNormal()

This action returns the normal vector of the plane.

Return

Libraries.Compute.Vector3: The normal vector of the plane

IsFrontFacing(Libraries.Compute.Vector3 direction)

This action determines whether the plane is facing the passed direction vector. The direction vector can be thought of as the direction a camera looks in. The plane is front facing (and the action will return true) if the front side of the plane determined by the normal vector faces the camera.

Return

boolean: true if the plane is front facing, false if not

Set(Libraries.Compute.Vector3 normalVector, number distanceFromOrigin)

This action sets the plane's normal vector and distance form the origin.

Parameters

• Libraries.Compute.Vector3: The normal vector of the plane
• number distanceFromOrigin: The distance of the plane from the origin

Set(Libraries.Compute.Plane plane)

This action sets the plane using the normal vector and distance from the origin from the passed Plane object.

Set(Libraries.Compute.Vector3 normalVector, Libraries.Compute.Vector3 point)

This action sets the plane based on the passed normal vector and a point on the plane.

Set(number normalX, number normalY, number normalZ, number distanceFromOrigin)

This action sets the plane with the given normal vector from the passed x, y, and z components and the passed distance from the origin.

Parameters

• number normalX: The x component of the normal vector
• number normalY: The y component of the normal vector
• number normalZ: The z component of the normal vector
• number distanceFromOrigin: The distance from the origin

Set(Libraries.Compute.Vector3 point1, Libraries.Compute.Vector3 point2, Libraries.Compute.Vector3 point3)

This action sets the plane given the three passed points that are on the plane. The normal vector of the plane is calculated as the cross-product between (point1 - point2) x (point2 - point3).

TestPoint(number x, number y, number z)

This action returns which side the given point lies relative to the plane and its normal. "OnPlane" is returned if the point lies on the plane. "Front" is the side of the plane to which the normal points. "Back" is the side of the plane that is not the front.

Parameters

• number x: The x coordinate of the point to test
• number y: The y coordinate of the point to test
• number z: The z coordinate of the point to test

Return

text: which side of the plane the point is on

TestPoint(Libraries.Compute.Vector3 point)

This action returns which side the given point lies relative to the plane and its normal. "OnPlane" is returned if the point lies on the plane. "Front" is the side of the plane to which the normal points. "Back" is the side of the plane that is not the front.

Return

text: which side of the plane the point is on