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