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
.surfaces
.insert(Surface::new(GlobalPath::x_axis(), [0., 0., 1.]))?;
let curve = PartialCurve {
let mut curve = PartialCurve {
surface: Some(surface),
..Default::default()
}
.update_as_circle_from_radius(1.)
.build(&objects)?
.insert(&objects)?;
};
curve.update_as_circle_from_radius(1.);
let curve = curve.build(&objects)?.insert(&objects)?;
let range = RangeOnPath::from([[0.], [TAU]]);
let tolerance = 1.;

View File

@ -11,7 +11,10 @@ pub trait CurveBuilder {
fn update_as_v_axis(self) -> Self;
/// 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
fn update_as_line_from_points(
@ -37,11 +40,12 @@ impl CurveBuilder for PartialCurve {
self
}
fn update_as_circle_from_radius(self, radius: impl Into<Scalar>) -> Self {
Self {
path: Some(SurfacePath::circle_from_radius(radius)),
..self
}
fn update_as_circle_from_radius(
&mut self,
radius: impl Into<Scalar>,
) -> &mut Self {
self.path = Some(SurfacePath::circle_from_radius(radius));
self
}
fn update_as_line_from_points(

View File

@ -70,7 +70,7 @@ impl HalfEdgeBuilder for PartialHalfEdge {
) -> Result<Self, ValidationError> {
let mut curve = self.curve().into_partial();
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");