mirror of https://github.com/hannobraun/Fornjot
Simplify `PartialVertex::with_curve`
This commit is contained in:
parent
18e1fb6eb3
commit
9ba8e98735
|
@ -184,7 +184,7 @@ mod tests {
|
|||
.build(&objects)?;
|
||||
let vertex = Vertex::partial()
|
||||
.with_position(Some([0.]))
|
||||
.with_curve(Some(curve))
|
||||
.with_curve(curve)
|
||||
.build(&objects)?;
|
||||
|
||||
let half_edge =
|
||||
|
|
|
@ -25,7 +25,7 @@ impl TransformObject for PartialHalfEdge {
|
|||
Ok(vertex
|
||||
.into_partial()
|
||||
.transform(transform, objects)?
|
||||
.with_curve(Some(curve.clone())))
|
||||
.with_curve(curve.clone()))
|
||||
},
|
||||
)?;
|
||||
let global_form = self
|
||||
|
|
|
@ -24,7 +24,7 @@ impl TransformObject for PartialVertex {
|
|||
// coordinates and thus transforming the curve takes care of it.
|
||||
Ok(Self::default()
|
||||
.with_position(self.position())
|
||||
.with_curve(Some(curve))
|
||||
.with_curve(curve)
|
||||
.with_surface_form(surface_form))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ impl CycleBuilder for PartialCycle {
|
|||
let [from, to] =
|
||||
[(0., from), (1., to)].map(|(position, surface_form)| {
|
||||
Vertex::partial()
|
||||
.with_curve(Some(curve.clone()))
|
||||
.with_curve(curve.clone())
|
||||
.with_position(Some([position]))
|
||||
.with_surface_form(surface_form)
|
||||
});
|
||||
|
|
|
@ -75,7 +75,7 @@ impl HalfEdgeBuilder for PartialHalfEdge {
|
|||
let [back, front] = [a_curve, b_curve].map(|point_curve| {
|
||||
Vertex::partial()
|
||||
.with_position(Some(point_curve))
|
||||
.with_curve(Some(curve.clone()))
|
||||
.with_curve(curve.clone())
|
||||
.with_surface_form(surface_vertex.clone())
|
||||
});
|
||||
|
||||
|
@ -127,7 +127,7 @@ impl HalfEdgeBuilder for PartialHalfEdge {
|
|||
vertex.update_partial(|vertex| {
|
||||
vertex
|
||||
.with_position(Some([position]))
|
||||
.with_curve(Some(curve.clone()))
|
||||
.with_curve(curve.clone())
|
||||
})
|
||||
});
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ impl PartialHalfEdge {
|
|||
let curve = self.curve.into_full(objects)?;
|
||||
let vertices = self.vertices.try_map_ext(|vertex| {
|
||||
vertex
|
||||
.update_partial(|vertex| vertex.with_curve(Some(curve.clone())))
|
||||
.update_partial(|vertex| vertex.with_curve(curve.clone()))
|
||||
.into_full(objects)
|
||||
})?;
|
||||
|
||||
|
|
|
@ -46,13 +46,8 @@ impl PartialVertex {
|
|||
}
|
||||
|
||||
/// Provide a curve for the partial vertex
|
||||
pub fn with_curve(
|
||||
mut self,
|
||||
curve: Option<impl Into<MaybePartial<Curve>>>,
|
||||
) -> Self {
|
||||
if let Some(curve) = curve {
|
||||
self.curve = curve.into();
|
||||
}
|
||||
pub fn with_curve(mut self, curve: impl Into<MaybePartial<Curve>>) -> Self {
|
||||
self.curve = curve.into();
|
||||
self
|
||||
}
|
||||
|
||||
|
|
|
@ -217,7 +217,7 @@ mod tests {
|
|||
vertices[1] = vertices[1]
|
||||
.to_partial()
|
||||
// Arranging for an equal but not identical curve here.
|
||||
.with_curve(Some(valid.curve().to_partial()))
|
||||
.with_curve(valid.curve().to_partial())
|
||||
.build(&objects)?;
|
||||
|
||||
HalfEdge::new(vertices, valid.global_form().clone())
|
||||
|
|
|
@ -191,11 +191,11 @@ mod tests {
|
|||
|
||||
let valid = Vertex::partial()
|
||||
.with_position(Some([0.]))
|
||||
.with_curve(Some(
|
||||
.with_curve(
|
||||
Curve::partial()
|
||||
.with_surface(Some(objects.surfaces.xy_plane()))
|
||||
.update_as_u_axis(),
|
||||
))
|
||||
)
|
||||
.build(&objects)?;
|
||||
let invalid = Vertex::new(
|
||||
valid.position(),
|
||||
|
@ -219,11 +219,11 @@ mod tests {
|
|||
|
||||
let valid = Vertex::partial()
|
||||
.with_position(Some([0.]))
|
||||
.with_curve(Some(
|
||||
.with_curve(
|
||||
Curve::partial()
|
||||
.with_surface(Some(objects.surfaces.xy_plane()))
|
||||
.update_as_u_axis(),
|
||||
))
|
||||
)
|
||||
.build(&objects)?;
|
||||
let invalid = Vertex::new(
|
||||
valid.position(),
|
||||
|
|
Loading…
Reference in New Issue