Change style of `update_as_circle_from_radius`

This commit is contained in:
Hanno Braun 2022-11-11 14:43:07 +01:00
parent 686f635439
commit ad87bd46da
3 changed files with 15 additions and 12 deletions

View File

@ -291,13 +291,12 @@ mod tests {
let surface = objects let surface = objects
.surfaces .surfaces
.insert(Surface::new(GlobalPath::x_axis(), [0., 0., 1.]))?; .insert(Surface::new(GlobalPath::x_axis(), [0., 0., 1.]))?;
let curve = PartialCurve { let mut curve = PartialCurve {
surface: Some(surface), surface: Some(surface),
..Default::default() ..Default::default()
} };
.update_as_circle_from_radius(1.) curve.update_as_circle_from_radius(1.);
.build(&objects)? let curve = curve.build(&objects)?.insert(&objects)?;
.insert(&objects)?;
let range = RangeOnPath::from([[0.], [TAU]]); let range = RangeOnPath::from([[0.], [TAU]]);
let tolerance = 1.; let tolerance = 1.;

View File

@ -11,7 +11,10 @@ pub trait CurveBuilder {
fn update_as_v_axis(self) -> Self; fn update_as_v_axis(self) -> Self;
/// Update partial curve as a circle, from the provided radius /// Update partial curve as a circle, from the provided radius
fn update_as_circle_from_radius(self, radius: impl Into<Scalar>) -> Self; fn update_as_circle_from_radius(
&mut self,
radius: impl Into<Scalar>,
) -> &mut Self;
/// Update partial curve as a line, from the provided points /// Update partial curve as a line, from the provided points
fn update_as_line_from_points( fn update_as_line_from_points(
@ -37,11 +40,12 @@ impl CurveBuilder for PartialCurve {
self self
} }
fn update_as_circle_from_radius(self, radius: impl Into<Scalar>) -> Self { fn update_as_circle_from_radius(
Self { &mut self,
path: Some(SurfacePath::circle_from_radius(radius)), radius: impl Into<Scalar>,
..self ) -> &mut Self {
} self.path = Some(SurfacePath::circle_from_radius(radius));
self
} }
fn update_as_line_from_points( fn update_as_line_from_points(

View File

@ -70,7 +70,7 @@ impl HalfEdgeBuilder for PartialHalfEdge {
) -> Result<Self, ValidationError> { ) -> Result<Self, ValidationError> {
let mut curve = self.curve().into_partial(); let mut curve = self.curve().into_partial();
curve.global_form = Some(self.extract_global_curve()); curve.global_form = Some(self.extract_global_curve());
let curve = curve.update_as_circle_from_radius(radius); curve.update_as_circle_from_radius(radius);
let path = curve.path.expect("Expected path that was just created"); let path = curve.path.expect("Expected path that was just created");