geom3d 0.2.0

Data structures and algorithms for 3D geometric modeling.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use super::Curve;
use crate::{Float, Point3, Vec3};

#[derive(Debug)]
pub struct Line {
    pub origin: Point3,
    pub direction: Vec3,
}

impl Curve for Line {
    fn get_point(&self, u: Float) -> Point3 {
        self.origin + self.direction * u
    }

    fn project(&self, point: Point3) -> Float {
        (point - self.origin).dot(self.direction)
    }
}