alloy::geometry

Struct Line

source
pub struct Line { /* private fields */ }
Expand description

Representation of a line in 3D space that continues infinitely in both directions.

Implementations§

source§

impl Line

source

pub const unsafe fn new_unchecked(origin: Point3, direction: Vector3) -> Self

Create a new line from an origin and direction.

The direction is assumed to be normalized

§Safety

The direction must be normalized, otherwise the behavior is undefined.

§Parameters
  • origin - The origin of the line
  • direction - The direction of the line
source

pub fn new(origin: Point3, direction: &Vec3) -> Self

Create a new line from an origin and direction.

The direction is normalized if it is not already.

§Parameters
  • origin - The origin of the line
  • direction - The direction of the line
source§

impl Line

source

pub const fn origin(&self) -> &Point3

Get the origin of the line.

source

pub const fn direction(&self) -> &Vec3

Get the direction of the line.

source

pub fn point_at_distance(&self, distance: f32) -> Point3

Gets the point at the specified distance on the line

A value of 0 for the distance will return the origin of the line.

§Parameters
  • distance - The distance along the line to get the point at
source

pub fn distance_to(&self, point: &Point3) -> f32

Gets the distance between the line and a point

§Parameters
  • point - The point to get the distance to
source

pub fn contains_point(&self, point: &Point3) -> bool

Checks if the line contains a point

§Parameters
  • point - The point to check

Trait Implementations§

source§

impl Intersects<AABB> for Line

source§

fn intersects(&self, other: &AABB) -> bool

Determines if this object intersects with another object. Read more
source§

impl Intersects<Line> for AABB

source§

fn intersects(&self, other: &Line) -> bool

Determines if this object intersects with another object. Read more
source§

impl Intersects<Line> for Sphere

source§

fn intersects(&self, other: &Line) -> bool

Determines if this object intersects with another object. Read more
source§

impl Intersects<Sphere> for Line

source§

fn intersects(&self, other: &Sphere) -> bool

Determines if this object intersects with another object. Read more
source§

impl Intersects for Line

source§

fn intersects(&self, other: &Self) -> bool

Determines if this object intersects with another object. Read more

Auto Trait Implementations§

§

impl Freeze for Line

§

impl RefUnwindSafe for Line

§

impl Send for Line

§

impl Sync for Line

§

impl Unpin for Line

§

impl UnwindSafe for Line

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<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, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.