pub struct Line<T> { /* private fields */ }
Implementations§
Source§impl<T> Line<T>where
T: Ccwable,
impl<T> Line<T>where
T: Ccwable,
Sourcepub fn dir(&self) -> Complex<T>
pub fn dir(&self) -> Complex<T>
Examples found in repository?
crates/competitive/src/geometry/line.rs (line 24)
23 pub fn is_parallel(&self, other: &Self) -> bool {
24 Approx(self.dir().cross(other.dir())) == Approx(T::zero())
25 }
26 pub fn is_orthogonal(&self, other: &Self) -> bool {
27 Approx(self.dir().dot(other.dir())) == Approx(T::zero())
28 }
29}
30impl<T> Line<T>
31where
32 T: Ccwable + Float,
33{
34 pub fn projection(&self, p: Complex<T>) -> Complex<T> {
35 let e = self.dir().unit();
36 self.p1 + e * (p - self.p1).dot(e)
37 }
38 pub fn reflection(&self, p: Complex<T>) -> Complex<T> {
39 let d = self.projection(p) - p;
40 p + d + d
41 }
42 pub fn distance_point(&self, p: Complex<T>) -> T {
43 (p / self.dir().unit()).re
44 }
pub fn ccw(&self, p: Complex<T>) -> Ccw
pub fn is_parallel(&self, other: &Self) -> bool
pub fn is_orthogonal(&self, other: &Self) -> bool
Source§impl<T> Line<T>
impl<T> Line<T>
Sourcepub fn projection(&self, p: Complex<T>) -> Complex<T>
pub fn projection(&self, p: Complex<T>) -> Complex<T>
pub fn reflection(&self, p: Complex<T>) -> Complex<T>
pub fn distance_point(&self, p: Complex<T>) -> T
Trait Implementations§
impl<T> StructuralPartialEq for Line<T>
Auto Trait Implementations§
impl<T> Freeze for Line<T>where
T: Freeze,
impl<T> RefUnwindSafe for Line<T>where
T: RefUnwindSafe,
impl<T> Send for Line<T>where
T: Send,
impl<T> Sync for Line<T>where
T: Sync,
impl<T> Unpin for Line<T>where
T: Unpin,
impl<T> UnwindSafe for Line<T>where
T: UnwindSafe,
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