mirror of https://github.com/hannobraun/Fornjot
Change style of `infer_surface_form`
This commit is contained in:
parent
807f824746
commit
6f8f06f261
|
@ -11,11 +11,11 @@ use crate::{
|
||||||
/// Builder API for [`PartialVertex`]
|
/// Builder API for [`PartialVertex`]
|
||||||
pub trait VertexBuilder {
|
pub trait VertexBuilder {
|
||||||
/// Remove the surface form of the partial vertex, inferring it on build
|
/// Remove the surface form of the partial vertex, inferring it on build
|
||||||
fn infer_surface_form(self) -> Self;
|
fn infer_surface_form(&mut self) -> &mut Self;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl VertexBuilder for PartialVertex {
|
impl VertexBuilder for PartialVertex {
|
||||||
fn infer_surface_form(mut self) -> Self {
|
fn infer_surface_form(&mut self) -> &mut Self {
|
||||||
self.surface_form = PartialSurfaceVertex::default().into();
|
self.surface_form = PartialSurfaceVertex::default().into();
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,8 @@ mod tests {
|
||||||
|
|
||||||
// Sever connection between the last and first half-edge in the
|
// Sever connection between the last and first half-edge in the
|
||||||
// cycle.
|
// cycle.
|
||||||
let first_vertex = first_vertex.into_partial().infer_surface_form();
|
let mut first_vertex = first_vertex.into_partial();
|
||||||
|
first_vertex.infer_surface_form();
|
||||||
*first_half_edge = first_half_edge
|
*first_half_edge = first_half_edge
|
||||||
.clone()
|
.clone()
|
||||||
.with_back_vertex(first_vertex)
|
.with_back_vertex(first_vertex)
|
||||||
|
|
|
@ -308,10 +308,8 @@ mod tests {
|
||||||
|vertex| -> anyhow::Result<_, ValidationError> {
|
|vertex| -> anyhow::Result<_, ValidationError> {
|
||||||
let mut vertex = vertex.to_partial();
|
let mut vertex = vertex.to_partial();
|
||||||
vertex.position = Some([0.].into());
|
vertex.position = Some([0.].into());
|
||||||
Ok(vertex
|
vertex.infer_surface_form();
|
||||||
.infer_surface_form()
|
Ok(vertex.build(&objects)?.insert(&objects)?)
|
||||||
.build(&objects)?
|
|
||||||
.insert(&objects)?)
|
|
||||||
},
|
},
|
||||||
)?,
|
)?,
|
||||||
valid.global_form().clone(),
|
valid.global_form().clone(),
|
||||||
|
|
Loading…
Reference in New Issue