mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-10 12:58:28 +00:00
Add LineSegment::to_line
This commit is contained in:
parent
b88f4728dc
commit
ef5830fc79
@ -1,6 +1,6 @@
|
|||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
use crate::Scalar;
|
use crate::{Line, Scalar};
|
||||||
|
|
||||||
use super::Point;
|
use super::Point;
|
||||||
|
|
||||||
@ -30,6 +30,16 @@ impl<const D: usize> LineSegment<D> {
|
|||||||
self.points.reverse();
|
self.points.reverse();
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// # Convert this `LineSegment` into a [`Line`]
|
||||||
|
///
|
||||||
|
/// This provides access to various utility methods.
|
||||||
|
pub fn to_line(&self) -> Line<D> {
|
||||||
|
let [a, b] = self.points;
|
||||||
|
let [a_line, b_line] = self.points_line;
|
||||||
|
|
||||||
|
Line::from_points_with_line_coords([(a_line, a), (b_line, b)])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl LineSegment<2> {
|
impl LineSegment<2> {
|
||||||
|
Loading…
Reference in New Issue
Block a user