pub struct Line {
pub origin: Vec3,
pub direction: Vec3,
}Expand description
An infinite line defined by a point and a direction.
Fields§
§origin: Vec3§direction: Vec3Normalized direction.
Implementations§
Source§impl Line
impl Line
Sourcepub fn new(origin: Vec3, direction: Vec3) -> Result<Self, HisabError>
pub fn new(origin: Vec3, direction: Vec3) -> Result<Self, HisabError>
Create a new line. Direction is normalized automatically.
§Errors
Returns crate::HisabError::InvalidInput if direction is zero-length.
Sourcepub fn closest_point(&self, point: Vec3) -> Vec3
pub fn closest_point(&self, point: Vec3) -> Vec3
Closest point on this infinite line to the given point.
Sourcepub fn distance_to_point(&self, point: Vec3) -> f32
pub fn distance_to_point(&self, point: Vec3) -> f32
Distance from a point to this line.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Line
impl<'de> Deserialize<'de> for Line
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Copy for Line
impl StructuralPartialEq for Line
Auto Trait Implementations§
impl Freeze for Line
impl RefUnwindSafe for Line
impl Send for Line
impl Sync for Line
impl Unpin for Line
impl UnsafeUnpin for Line
impl UnwindSafe for Line
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