mirror of https://github.com/hannobraun/Fornjot
Remove `PartialVertex::with_curve`
This commit is contained in:
parent
4f4ddeffe9
commit
8c1077ae2a
|
@ -187,9 +187,9 @@ mod tests {
|
|||
let curve = curve.build(&objects)?.insert(&objects)?;
|
||||
let vertex = PartialVertex {
|
||||
position: Some([0.].into()),
|
||||
curve: curve.into(),
|
||||
..Default::default()
|
||||
}
|
||||
.with_curve(curve)
|
||||
.build(&objects)?
|
||||
.insert(&objects)?;
|
||||
|
||||
|
|
|
@ -22,10 +22,10 @@ impl TransformObject for PartialHalfEdge {
|
|||
.into();
|
||||
let vertices = self.vertices().try_map_ext(
|
||||
|vertex| -> Result<_, ValidationError> {
|
||||
Ok(vertex
|
||||
.into_partial()
|
||||
.transform(transform, objects)?
|
||||
.with_curve(curve.clone()))
|
||||
let mut vertex =
|
||||
vertex.into_partial().transform(transform, objects)?;
|
||||
vertex.curve = curve.clone();
|
||||
Ok(vertex)
|
||||
},
|
||||
)?;
|
||||
let global_form = self
|
||||
|
|
|
@ -24,9 +24,9 @@ impl TransformObject for PartialVertex {
|
|||
// coordinates and thus transforming the curve takes care of it.
|
||||
Ok(Self {
|
||||
position: self.position,
|
||||
curve,
|
||||
..Default::default()
|
||||
}
|
||||
.with_curve(curve)
|
||||
.with_surface_form(surface_form))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,9 +78,9 @@ impl CycleBuilder for PartialCycle {
|
|||
|(position, surface_form)| {
|
||||
PartialVertex {
|
||||
position: Some([position].into()),
|
||||
curve: curve.clone().into(),
|
||||
..Default::default()
|
||||
}
|
||||
.with_curve(curve.clone())
|
||||
.with_surface_form(surface_form)
|
||||
},
|
||||
);
|
||||
|
|
|
@ -99,9 +99,9 @@ impl HalfEdgeBuilder for PartialHalfEdge {
|
|||
let [back, front] = [a_curve, b_curve].map(|point_curve| {
|
||||
PartialVertex {
|
||||
position: Some(point_curve),
|
||||
curve: curve.clone().into(),
|
||||
..Default::default()
|
||||
}
|
||||
.with_curve(curve.clone())
|
||||
.with_surface_form(surface_vertex.clone())
|
||||
});
|
||||
|
||||
|
@ -156,7 +156,8 @@ impl HalfEdgeBuilder for PartialHalfEdge {
|
|||
let vertices = [(from, 0.), (to, 1.)].map(|(vertex, position)| {
|
||||
vertex.update_partial(|mut vertex| {
|
||||
vertex.position = Some([position].into());
|
||||
vertex.with_curve(curve.clone())
|
||||
vertex.curve = curve.clone().into();
|
||||
vertex
|
||||
})
|
||||
});
|
||||
|
||||
|
|
|
@ -100,7 +100,10 @@ impl PartialHalfEdge {
|
|||
let curve = self.curve.into_full(objects)?;
|
||||
let vertices = self.vertices.try_map_ext(|vertex| {
|
||||
vertex
|
||||
.update_partial(|vertex| vertex.with_curve(curve.clone()))
|
||||
.update_partial(|mut vertex| {
|
||||
vertex.curve = curve.clone().into();
|
||||
vertex
|
||||
})
|
||||
.into_full(objects)
|
||||
})?;
|
||||
|
||||
|
|
|
@ -24,12 +24,6 @@ pub struct PartialVertex {
|
|||
}
|
||||
|
||||
impl PartialVertex {
|
||||
/// Provide a curve for the partial vertex
|
||||
pub fn with_curve(mut self, curve: impl Into<MaybePartial<Curve>>) -> Self {
|
||||
self.curve = curve.into();
|
||||
self
|
||||
}
|
||||
|
||||
/// Provide a surface form for the partial vertex
|
||||
pub fn with_surface_form(
|
||||
mut self,
|
||||
|
|
|
@ -220,12 +220,10 @@ mod tests {
|
|||
.build(&objects)?;
|
||||
let invalid = {
|
||||
let mut vertices = valid.vertices().clone();
|
||||
vertices[1] = vertices[1]
|
||||
.to_partial()
|
||||
let mut vertex = vertices[1].to_partial();
|
||||
// Arranging for an equal but not identical curve here.
|
||||
.with_curve(valid.curve().to_partial())
|
||||
.build(&objects)?
|
||||
.insert(&objects)?;
|
||||
vertex.curve = valid.curve().to_partial().into();
|
||||
vertices[1] = vertex.build(&objects)?.insert(&objects)?;
|
||||
|
||||
HalfEdge::new(vertices, valid.global_form().clone())
|
||||
};
|
||||
|
|
|
@ -200,9 +200,9 @@ mod tests {
|
|||
|
||||
let valid = PartialVertex {
|
||||
position: Some([0.].into()),
|
||||
curve: curve.into(),
|
||||
..Default::default()
|
||||
}
|
||||
.with_curve(curve)
|
||||
.build(&objects)?;
|
||||
let invalid = Vertex::new(valid.position(), valid.curve().clone(), {
|
||||
let mut tmp = valid.surface_form().to_partial();
|
||||
|
@ -229,9 +229,9 @@ mod tests {
|
|||
|
||||
PartialVertex {
|
||||
position: Some([0.].into()),
|
||||
curve: curve.into(),
|
||||
..Default::default()
|
||||
}
|
||||
.with_curve(curve)
|
||||
.build(&objects)?
|
||||
};
|
||||
let invalid = Vertex::new(valid.position(), valid.curve().clone(), {
|
||||
|
|
Loading…
Reference in New Issue