Inline CurveBuilder method

This commit is contained in:
Hanno Braun 2023-02-24 14:27:43 +01:00
parent b3cc84608a
commit b94f9a7ab0
2 changed files with 4 additions and 24 deletions

View File

@ -1,18 +1,9 @@
use fj_math::{Point, Scalar};
use fj_math::Point;
use crate::{geometry::path::SurfacePath, partial::PartialCurve};
/// Builder API for [`PartialCurve`]
pub trait CurveBuilder {
/// Update partial curve to be a circle, from the provided radius
///
/// Returns the updated path.
fn update_as_circle_from_center_and_radius(
&mut self,
center: impl Into<Point<2>>,
radius: impl Into<Scalar>,
) -> SurfacePath;
/// Update partial curve to be a line, from the provided points
///
/// Returns the updated path.
@ -31,16 +22,6 @@ pub trait CurveBuilder {
}
impl CurveBuilder for PartialCurve {
fn update_as_circle_from_center_and_radius(
&mut self,
center: impl Into<Point<2>>,
radius: impl Into<Scalar>,
) -> SurfacePath {
let path = SurfacePath::circle_from_center_and_radius(center, radius);
self.path = Some(path.into());
path
}
fn update_as_line_from_points(
&mut self,
points: [impl Into<Point<2>>; 2],

View File

@ -133,10 +133,9 @@ impl HalfEdgeBuilder for PartialHalfEdge {
let arc = fj_math::Arc::from_endpoints_and_angle(start, end, angle_rad);
let path = self
.curve
.write()
.update_as_circle_from_center_and_radius(arc.center, arc.radius);
let path =
SurfacePath::circle_from_center_and_radius(arc.center, arc.radius);
self.curve.write().path = Some(path.into());
let [a_curve, b_curve] =
[arc.start_angle, arc.end_angle].map(|coord| Point::from([coord]));