pub struct Ray {
pub origin: Vector3,
pub direction: Vector3,
}Expand description
Port of three.js’ Ray: an infinite ray from an origin along a
direction, used by Raycaster for picking.
Fields§
§origin: Vector3The origin of the ray.
direction: Vector3The (normalized) direction of the ray.
Implementations§
Source§impl Ray
impl Ray
Sourcepub fn closest_point_to_point(&self, point: &Vector3) -> Vector3
pub fn closest_point_to_point(&self, point: &Vector3) -> Vector3
Ray.closestPointToPoint().
Sourcepub fn distance_to_point(&self, point: &Vector3) -> f64
pub fn distance_to_point(&self, point: &Vector3) -> f64
Ray.distanceToPoint().
Sourcepub fn distance_sq_to_point(&self, point: &Vector3) -> f64
pub fn distance_sq_to_point(&self, point: &Vector3) -> f64
Ray.distanceSqToPoint().
Sourcepub fn distance_sq_to_segment(
&self,
v0: &Vector3,
v1: &Vector3,
optional_point_on_ray: Option<&mut Vector3>,
optional_point_on_segment: Option<&mut Vector3>,
) -> f64
pub fn distance_sq_to_segment( &self, v0: &Vector3, v1: &Vector3, optional_point_on_ray: Option<&mut Vector3>, optional_point_on_segment: Option<&mut Vector3>, ) -> f64
Ray.distanceSqToSegment().
optional_point_on_ray / optional_point_on_segment are three.js’
out-params: when given they receive the closest point on the ray and on
the segment respectively.
Sourcepub fn intersect_sphere(&self, sphere: &Sphere) -> Option<Vector3>
pub fn intersect_sphere(&self, sphere: &Sphere) -> Option<Vector3>
Ray.intersectSphere().
Sourcepub fn intersects_sphere(&self, sphere: &Sphere) -> bool
pub fn intersects_sphere(&self, sphere: &Sphere) -> bool
Ray.intersectsSphere().
Sourcepub fn distance_to_plane(&self, plane: &Plane) -> Option<f64>
pub fn distance_to_plane(&self, plane: &Plane) -> Option<f64>
Ray.distanceToPlane().
Sourcepub fn intersect_plane(&self, plane: &Plane) -> Option<Vector3>
pub fn intersect_plane(&self, plane: &Plane) -> Option<Vector3>
Ray.intersectPlane().
Sourcepub fn intersects_plane(&self, plane: &Plane) -> bool
pub fn intersects_plane(&self, plane: &Plane) -> bool
Ray.intersectsPlane().
Sourcepub fn intersect_box(&self, box3: &Box3) -> Option<Vector3>
pub fn intersect_box(&self, box3: &Box3) -> Option<Vector3>
Ray.intersectBox().
Sourcepub fn intersects_box(&self, box3: &Box3) -> bool
pub fn intersects_box(&self, box3: &Box3) -> bool
Ray.intersectsBox().
Sourcepub fn intersect_triangle(
&self,
a: &Vector3,
b: &Vector3,
c: &Vector3,
backface_culling: bool,
) -> Option<Vector3>
pub fn intersect_triangle( &self, a: &Vector3, b: &Vector3, c: &Vector3, backface_culling: bool, ) -> Option<Vector3>
Ray.intersectTriangle().
Sourcepub fn apply_matrix4(&mut self, matrix4: &Matrix4) -> &mut Self
pub fn apply_matrix4(&mut self, matrix4: &Matrix4) -> &mut Self
Ray.applyMatrix4().
Trait Implementations§
impl Copy for Ray
impl StructuralPartialEq for Ray
Auto Trait Implementations§
impl Freeze for Ray
impl RefUnwindSafe for Ray
impl Send for Ray
impl Sync for Ray
impl Unpin for Ray
impl UnsafeUnpin for Ray
impl UnwindSafe for Ray
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more