logo
pub struct Ray3 {
    pub origin: Vec3,
    pub dir: Vec3,
}
Expand description

A ray in 3-dimensional space: a line through space with a starting point and a direction.

Any point on the ray can be found through the formula origin + t * dir, where t is a non-negative floating point value, which represents the distance along the ray.

Fields

origin: Vec3

Start of the ray

dir: Vec3

Direction of the ray, normalized

Implementations

An invalid ray, starting at the origin and going nowhere.

dir should be normalized

Get normalized ray (where dir.len() == 1).

Returns a new ray that has had its origin moved a given distance forwards along the ray.

If the ray direction is normalized then the t parameter corresponds to the world space distance it moves.

True if every value is finite

Returns the line segment where self and other are the closest to each other. If the rays are parallel then non-finite points are returned.

Returns the distance along both rays which together form line segment where self and other are the closest to each other. If the rays are parallel then non-finite values are returned.

Returns the point where the ray intersects the plane. Returns non-finite result of the ray and plane are parallel.

Returns the point along the ray that is closest to the given point. The returned point may be “behind” the ray origin.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.