## Libraries.Compute.Ray Documentation

This class represents a ray. A ray has a starting position and a unit length direction.

*Inherits from: *Libraries.Language.Object

## Summary

### Actions Summary Table

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

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

Copy() | This action creates a new Ray that is a copy of this Ray. |

Equals(Libraries.Compute.Ray ray) | This action determines if the passed ray is equal to this ray. |

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

GetDirection() | This action returns the direction of the Ray. |

GetEndPoint(number distance) | This action returns the endpoint of the Ray given the distance. |

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

GetOrigin() | This action returns the origin of the Ray. |

Multiply(Libraries.Compute.Matrix4 matrix) | This action multiplies the Ray by the passed matrix. |

Set(Libraries.Compute.Ray ray) | This action sets the ray using the direction and orgin of the passed ray. |

Set(Libraries.Compute.Vector3 origin, Libraries.Compute.Vector3 direction) | This action sets the ray using the passed origin and direction vectors. |

Set(number originX, number originY, number originZ, number directionX, number directionY, number directionZ) | This action sets the ray using the passed origin and direction vectors. |

SetDirection(Libraries.Compute.Vector3 direction) | This action sets the direction of the ray to the passed direction vector. |

SetOrigin(Libraries.Compute.Vector3 origin) | This action sets the origin of the ray to the passed origin vector. |

## Actions Documentation

### Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns a CompareResult. The compare result is either larger if this hash code is larger than the object passed as a parameter, smaller, or equal.

**Example Code**

```
use Libraries.Language.Support.CompareResult
Object o
Object t
CompareResult result = o:Compare(t)
```

#### Parameters

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

#### Return

Libraries.Language.Support.CompareResult: The Compare result, Smaller, Equal, or Larger.

### Copy()

This action creates a new Ray that is a copy of this Ray.

#### Return

Libraries.Compute.Ray: A new Ray that is a copy of this Ray

### Equals(Libraries.Compute.Ray ray)

This action determines if the passed ray is equal to this ray. Two Rays are equal if their origins and directions are the same.

#### Parameters

- Libraries.Compute.Ray: The Ray to check as equal to this Ray

#### Return

boolean: true if the two rays are equal, false otherwise

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

### GetDirection()

This action returns the direction of the Ray.

#### Return

Libraries.Compute.Vector3: The direction vector of the Ray

### GetEndPoint(number distance)

This action returns the endpoint of the Ray given the distance. The calculation is: startpoint + distance * direction.

#### Parameters

- number distance: The distance from the end point to the start point

#### Return

Libraries.Compute.Vector3: The endpoint given the distance as a Vector

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

### GetOrigin()

This action returns the origin of the Ray.

#### Return

Libraries.Compute.Vector3: The origin vector of the Ray

### Multiply(Libraries.Compute.Matrix4 matrix)

This action multiplies the Ray by the passed matrix. This action can be used to transform this ray into another coordinate system.

#### Parameters

- Libraries.Compute.Matrix4: The matrix to multiply the Ray by

#### Return

Libraries.Compute.Ray: The result of the multiplication

### Set(Libraries.Compute.Ray ray)

This action sets the ray using the direction and orgin of the passed ray.

#### Parameters

- Libraries.Compute.Ray: The Ray to use to set this ray

#### Return

Libraries.Compute.Ray: The Ray after being set

### Set(Libraries.Compute.Vector3 origin, Libraries.Compute.Vector3 direction)

This action sets the ray using the passed origin and direction vectors.

#### Parameters

#### Return

Libraries.Compute.Ray: The Ray after being set

### Set(number originX, number originY, number originZ, number directionX, number directionY, number directionZ)

This action sets the ray using the passed origin and direction vectors.

#### Parameters

#### Return

Libraries.Compute.Ray: The Ray after being set

### SetDirection(Libraries.Compute.Vector3 direction)

This action sets the direction of the ray to the passed direction vector.

#### Parameters

- Libraries.Compute.Vector3: The vector to set as the direction of the Ray

### SetOrigin(Libraries.Compute.Vector3 origin)

This action sets the origin of the ray to the passed origin vector.

#### Parameters

- Libraries.Compute.Vector3: The vector to set as the origin of the Ray