# Ray

#### new Cesium.Ray(origin, direction)
engine/Source/Core/Ray.js 14

Represents a ray that extends infinitely from the provided origin in the provided direction.

Name | Type | Default | Description
--- | --- | --- | ---
`origin` | Cartesian3 | `Cartesian3.ZERO` | optional The origin of the ray.
`direction` | Cartesian3 | `Cartesian3.ZERO` | optional The direction of the ray.

### Members

#### direction : Cartesian3
engine/Source/Core/Ray.js 31

The direction of the ray.

#### origin : Cartesian3
engine/Source/Core/Ray.js 25

The origin of the ray.

Default Value: ``Cartesian3.ZERO``

### Methods

#### static Cesium.Ray.clone(ray, result) → Ray
engine/Source/Core/Ray.js 41

Duplicates a Ray instance.

Name | Type | Description
--- | --- | ---
`ray` | Ray | The ray to duplicate.
`result` | Ray | optional The object onto which to store the result.

##### Returns:

The modified result parameter or a new Ray instance if one was not provided. (Returns undefined if ray is undefined)

#### static Cesium.Ray.getPoint(ray, t, result) → Cartesian3
engine/Source/Core/Ray.js 67

Computes the point along the ray given by r(t) = o + t*d, where o is the origin of the ray and d is the direction.

Name | Type | Description
--- | --- | ---
`ray` | Ray | The ray.
`t` | number | A scalar value.
`result` | Cartesian3 | optional The object in which the result will be stored.

##### Returns:

The modified result parameter, or a new instance if none was provided.

##### Example:

    //Get the first intersection point of a ray and an ellipsoid.
    const intersection = Cesium.IntersectionTests.rayEllipsoid(ray, ellipsoid);
    const point = Cesium.Ray.getPoint(ray, intersection.start);

Need help? The fastest way to get answers is from the community and team on the Cesium Forum.