pub struct Ray<S: Scalar> { /* private fields */ }Expand description
The points origin + t dir for t >= 0. dir has unit length, so t
is a distance.
Implementations§
Source§impl<S: Scalar> Ray<S>
impl<S: Scalar> Ray<S>
Sourcepub fn try_new(origin: Vector3<S>, dir: Vector3<S>) -> GeopResult<Self>
pub fn try_new(origin: Vector3<S>, dir: Vector3<S>) -> GeopResult<Self>
The ray from origin along dir, of any length. Fails if dir
could be zero.
pub fn origin(&self) -> &Vector3<S>
Sourcepub fn closest_to_point(&self, p: &Vector3<S>) -> S
pub fn closest_to_point(&self, p: &Vector3<S>) -> S
How far along the ray it comes closest to p, never behind its
origin.
Sourcepub fn distance_to_point(&self, p: &Vector3<S>) -> (S, S)
pub fn distance_to_point(&self, p: &Vector3<S>) -> (S, S)
How far the ray passes from p, and how far along it that is.
Sourcepub fn distance_to_segment(&self, a: &Vector3<S>, b: &Vector3<S>) -> (S, S)
pub fn distance_to_segment(&self, a: &Vector3<S>, b: &Vector3<S>) -> (S, S)
How far the ray passes from the segment a..b, and how far along
the ray that is.
Sourcepub fn intersect_triangle(
&self,
a: &Vector3<S>,
b: &Vector3<S>,
c: &Vector3<S>,
) -> Option<S>
pub fn intersect_triangle( &self, a: &Vector3<S>, b: &Vector3<S>, c: &Vector3<S>, ) -> Option<S>
How far along the ray it enters the triangle a, b, c, if it could
(Möller–Trumbore).
Sourcepub fn intersect_plane(
&self,
origin: &Vector3<S>,
normal: &Vector3<S>,
) -> Option<(S, Vector3<S>)>
pub fn intersect_plane( &self, origin: &Vector3<S>, normal: &Vector3<S>, ) -> Option<(S, Vector3<S>)>
Where the ray meets the plane through origin normal to normal,
and how far along it: None if it could run along the plane, or
points away from it.
Sourcepub fn intersect_uv_plane(
&self,
frame: &CoordinateSystem<S>,
) -> Option<(S, Vector2<S>)>
pub fn intersect_uv_plane( &self, frame: &CoordinateSystem<S>, ) -> Option<(S, Vector2<S>)>
Where the ray meets frame’s u/v plane, in u/v coordinates,
and how far along the ray: None if it could run along the plane,
or points away from it.
Sourcepub fn line_parameter(
&self,
at: &Vector3<S>,
direction: &Vector3<S>,
) -> Option<S>
pub fn line_parameter( &self, at: &Vector3<S>, direction: &Vector3<S>, ) -> Option<S>
The parameter s of the point at + s direction of a line nearest
the ray’s line. None if the two could be parallel, where no point
of the line is nearer than another.