Skip to content

Commit

Permalink
Add LineSegment::to_line
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed Sep 26, 2024
1 parent b88f472 commit ef5830f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion crates/fj-math/src/line_segment.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::fmt;

use crate::Scalar;
use crate::{Line, Scalar};

use super::Point;

Expand Down Expand Up @@ -30,6 +30,16 @@ impl<const D: usize> LineSegment<D> {
self.points.reverse();
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> {
Expand Down

0 comments on commit ef5830f

Please sign in to comment.