Skip to main content

Intersection

Struct Intersection 

Source
pub struct Intersection {
Show 14 fields pub distance: f64, pub distance_to_ray: Option<f64>, pub point: Vector3, pub point_on_line: Option<Vector3>, pub index: Option<usize>, pub face: Option<Face>, pub face_index: Option<usize>, pub uv: Option<Vector2>, pub uv1: Option<Vector2>, pub normal: Option<Vector3>, pub barycoord: Option<Vector3>, pub instance_id: Option<usize>, pub batch_id: Option<usize>, pub object: ObjectRef,
}
Expand description

One entry of the array Raycaster.intersectObject() returns.

three.js builds a plain object whose keys depend on what was hit; every key that some raycast() can leave out is an Option here, None being both three’s absent key and its explicit null.

Fields§

§distance: f64

distance — from the ray origin to the hit, in world units.

§distance_to_ray: Option<f64>

distanceToRay — Points only: how far the point is from the ray.

§point: Vector3

point — the hit in world space.

§point_on_line: Option<Vector3>

pointOnLine — LineSegments2 only: the closest point on the segment.

§index: Option<usize>

index — Line / Points only: the segment’s first vertex, or the point.

§face: Option<Face>

face — meshes only.

§face_index: Option<usize>

faceIndex — the triangle number for a mesh, the segment number for a LineSegments2.

§uv: Option<Vector2>

uv at the hit — meshes with a uv attribute, and sprites.

§uv1: Option<Vector2>

uv1 at the hit.

§normal: Option<Vector3>

normal — the interpolated vertex normal, flipped to face the ray.

§barycoord: Option<Vector3>

barycoord — the hit’s barycentric coordinates in the triangle.

§instance_id: Option<usize>

instanceId — InstancedMesh only.

§batch_id: Option<usize>

batchId — BatchedMesh only.

§object: ObjectRef

object — the object that was hit.

Implementations§

Source§

impl Intersection

Source

pub fn new(distance: f64, point: Vector3, object: ObjectRef) -> Self

The fields every hit has; the rest start absent.

Trait Implementations§

Source§

impl Clone for Intersection

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Intersection

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.