mirror of
https://github.com/hannobraun/Fornjot
synced 2025-02-06 15:25:53 +00:00
Inline CurveBuilder
method
This commit is contained in:
parent
b3cc84608a
commit
b94f9a7ab0
@ -1,18 +1,9 @@
|
|||||||
use fj_math::{Point, Scalar};
|
use fj_math::Point;
|
||||||
|
|
||||||
use crate::{geometry::path::SurfacePath, partial::PartialCurve};
|
use crate::{geometry::path::SurfacePath, partial::PartialCurve};
|
||||||
|
|
||||||
/// Builder API for [`PartialCurve`]
|
/// Builder API for [`PartialCurve`]
|
||||||
pub trait CurveBuilder {
|
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
|
/// Update partial curve to be a line, from the provided points
|
||||||
///
|
///
|
||||||
/// Returns the updated path.
|
/// Returns the updated path.
|
||||||
@ -31,16 +22,6 @@ pub trait CurveBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl CurveBuilder for PartialCurve {
|
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(
|
fn update_as_line_from_points(
|
||||||
&mut self,
|
&mut self,
|
||||||
points: [impl Into<Point<2>>; 2],
|
points: [impl Into<Point<2>>; 2],
|
||||||
|
@ -133,10 +133,9 @@ impl HalfEdgeBuilder for PartialHalfEdge {
|
|||||||
|
|
||||||
let arc = fj_math::Arc::from_endpoints_and_angle(start, end, angle_rad);
|
let arc = fj_math::Arc::from_endpoints_and_angle(start, end, angle_rad);
|
||||||
|
|
||||||
let path = self
|
let path =
|
||||||
.curve
|
SurfacePath::circle_from_center_and_radius(arc.center, arc.radius);
|
||||||
.write()
|
self.curve.write().path = Some(path.into());
|
||||||
.update_as_circle_from_center_and_radius(arc.center, arc.radius);
|
|
||||||
|
|
||||||
let [a_curve, b_curve] =
|
let [a_curve, b_curve] =
|
||||||
[arc.start_angle, arc.end_angle].map(|coord| Point::from([coord]));
|
[arc.start_angle, arc.end_angle].map(|coord| Point::from([coord]));
|
||||||
|
Loading…
Reference in New Issue
Block a user