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 { Ok(PartialCurve {
path: self.path, path: self.path,
surface, surface,
..Default::default() global_form,
} })
.with_global_form(global_form))
} }
} }

View File

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

View File

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

View File

@ -22,17 +22,6 @@ pub struct PartialCurve {
} }
impl 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 /// Build a full [`Curve`] from the partial curve
pub fn build(self, objects: &Objects) -> Result<Curve, ValidationError> { pub fn build(self, objects: &Objects) -> Result<Curve, ValidationError> {
let path = self.path.expect("Can't build `Curve` without path"); let path = self.path.expect("Can't build `Curve` without path");