Remove `PartialCurve::with_global_form`

This commit is contained in:
Hanno Braun 2022-11-11 14:32:04 +01:00
parent 8524c2f773
commit 651cd6bfa3
4 changed files with 19 additions and 26 deletions

View File

@ -42,8 +42,7 @@ impl TransformObject for PartialCurve {
Ok(PartialCurve {
path: self.path,
surface,
..Default::default()
}
.with_global_form(global_form))
global_form,
})
}
}

View File

@ -68,11 +68,9 @@ impl HalfEdgeBuilder for PartialHalfEdge {
radius: impl Into<Scalar>,
objects: &Objects,
) -> Result<Self, ValidationError> {
let curve = self
.curve()
.into_partial()
.with_global_form(Some(self.extract_global_curve()))
.update_as_circle_from_radius(radius);
let mut curve = self.curve().into_partial();
curve.global_form = Some(self.extract_global_curve());
let curve = curve.update_as_circle_from_radius(radius);
let path = curve.path.expect("Expected path that was just created");
@ -143,9 +141,9 @@ impl HalfEdgeBuilder for PartialHalfEdge {
let curve = PartialCurve {
surface: Some(surface),
global_form: Some(self.extract_global_curve()),
..Default::default()
}
.with_global_form(Some(self.extract_global_curve()))
.update_as_line_from_points(points);
let [back, front] = {

View File

@ -9,10 +9,10 @@ use crate::{
builder::{FaceBuilder, HalfEdgeBuilder},
insert::Insert,
objects::{
Curve, Cycle, Face, FaceSet, HalfEdge, Objects, Shell, Surface,
SurfaceVertex, Vertex,
Cycle, Face, FaceSet, HalfEdge, Objects, Shell, Surface, SurfaceVertex,
Vertex,
},
partial::HasPartial,
partial::{HasPartial, PartialCurve},
storage::Handle,
};
@ -152,9 +152,16 @@ impl<'a> ShellBuilder<'a> {
.with_surface(Some(surface.clone()))
.with_global_form(Some(from.global_form().clone()));
let curve = Curve::partial().with_global_form(Some(
side_up_prev.curve().global_form().clone(),
));
let curve = PartialCurve {
global_form: Some(
side_up_prev
.curve()
.global_form()
.clone()
.into(),
),
..Default::default()
};
HalfEdge::partial()
.with_curve(curve)

View File

@ -22,17 +22,6 @@ pub struct PartialCurve {
}
impl PartialCurve {
/// Provide a global form for the partial curve
pub fn with_global_form(
mut self,
global_form: Option<impl Into<MaybePartial<GlobalCurve>>>,
) -> Self {
if let Some(global_form) = global_form {
self.global_form = Some(global_form.into());
}
self
}
/// Build a full [`Curve`] from the partial curve
pub fn build(self, objects: &Objects) -> Result<Curve, ValidationError> {
let path = self.path.expect("Can't build `Curve` without path");