Add line_from_origin_and_direction

This commit is contained in:
Hanno Braun 2025-04-25 12:14:15 +02:00
parent 4f8047d92e
commit 7dfb01485a

View File

@ -23,10 +23,10 @@ pub struct AnchoredCurve {
} }
impl AnchoredCurve { impl AnchoredCurve {
pub fn line_from_points([a, b]: [Point<3>; 2]) -> Self { pub fn line_from_origin_and_direction(
let origin = a; origin: Point<3>,
let direction = b - a; direction: Vector<3>,
) -> Self {
let line = Line { direction }; let line = Line { direction };
Self { Self {
@ -35,6 +35,13 @@ impl AnchoredCurve {
} }
} }
pub fn line_from_points([a, b]: [Point<3>; 2]) -> Self {
let origin = a;
let direction = b - a;
Self::line_from_origin_and_direction(origin, direction)
}
pub fn point_from_local(&self, point: Point<1>) -> Point<3> { pub fn point_from_local(&self, point: Point<1>) -> Point<3> {
self.floating.point_from_local(point) self.floating.point_from_local(point)
} }