## 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

## Summary

### Variable Summary Table

Variables | Description |
---|---|

text onPlane | |

text back | |

text front |

### Actions Summary Table

Actions | Description |
---|---|

Compare(Libraries.Language.Object object) | This action compares two object hash codes and returns an integer. |

Distance(Libraries.Compute.Vector3 point) | This action returns the shortest distance from the plane and the passed point. |

Equals(Libraries.Language.Object object) | This action determines if two objects are equal based on their hash code values. |

GetDistance() | This action returns the distance of the plane from the origin. |

GetHashCode() | This action gets the hash code for an object. |

GetNormal() | This action returns the normal vector of the plane. |

IsFrontFacing(Libraries.Compute.Vector3 direction) | This action determines whether the plane is facing the passed direction vector. |

Set(Libraries.Compute.Vector3 normalVector, number distanceFromOrigin) | This action sets the plane's normal vector and distance form 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. |

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. |

TestPoint(number x, number y, number z) | This action returns which side the given point lies relative to the plane and its normal. |

TestPoint(Libraries.Compute.Vector3 point) | This action returns which side the given point lies relative to the plane and its normal. |

## 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.

**Example Code**

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

#### Parameters

- Libraries.Language.Object: The object to compare to.

#### Return

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

### Distance(Libraries.Compute.Vector3 point)

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

#### Parameters

- Libraries.Compute.Vector3: The point to calculate the distance form the plane

#### 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.

**Example Code**

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

#### Parameters

- Libraries.Language.Object: The to be compared.

#### Return

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

### 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.

**Example Code**

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

#### Return

integer: The integer hash code of the object.

### 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.

#### Parameters

- Libraries.Compute.Vector3: The direction the camera looks in

#### 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.

#### Parameters

- Libraries.Compute.Plane: The plane to use to set this plane

### 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.

#### Parameters

- Libraries.Compute.Vector3: The normal vector of the plane
- Libraries.Compute.Vector3: The 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).

#### Parameters

- Libraries.Compute.Vector3: The first point
- Libraries.Compute.Vector3: The second point
- Libraries.Compute.Vector3: The thrid point

### 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.

#### Parameters

- Libraries.Compute.Vector3: The point to test

#### Return

text: which side of the plane the point is on