Update builder method

This commit is contained in:
Hanno Braun 2022-11-11 16:53:02 +01:00
parent 6f8f06f261
commit 674d33a6ba
2 changed files with 16 additions and 16 deletions

View File

@ -3,12 +3,9 @@ use iter_fixed::IntoIteratorFixed;
use crate::{
insert::Insert,
objects::{
Curve, GlobalVertex, Objects, Surface, Vertex,
VerticesInNormalizedOrder,
},
objects::{Curve, Objects, Surface, Vertex, VerticesInNormalizedOrder},
partial::{
HasPartial, MaybePartial, PartialCurve, PartialGlobalEdge,
MaybePartial, PartialCurve, PartialGlobalEdge, PartialGlobalVertex,
PartialHalfEdge, PartialSurfaceVertex, PartialVertex,
},
storage::Handle,
@ -82,10 +79,11 @@ impl HalfEdgeBuilder for PartialHalfEdge {
.vertices()
.map(|[global_form, _]| global_form)
.unwrap_or_else(|| {
let mut global_vertex = GlobalVertex::partial();
global_vertex
.update_from_curve_and_position(curve.clone(), a_curve);
global_vertex.into()
PartialGlobalVertex::from_curve_and_position(
curve.clone(),
a_curve,
)
.into()
});
let surface_vertex = PartialSurfaceVertex {

View File

@ -37,11 +37,10 @@ impl SurfaceVertexBuilder for PartialSurfaceVertex {
/// Builder API for [`PartialGlobalVertex`]
pub trait GlobalVertexBuilder {
/// Update partial global vertex from the given curve and position on it
fn update_from_curve_and_position(
&mut self,
fn from_curve_and_position(
curve: impl Into<MaybePartial<Curve>>,
position: impl Into<Point<1>>,
) -> &mut Self;
) -> Self;
/// Update partial global vertex from the given surface and position on it
fn update_from_surface_and_position(
@ -52,11 +51,10 @@ pub trait GlobalVertexBuilder {
}
impl GlobalVertexBuilder for PartialGlobalVertex {
fn update_from_curve_and_position(
&mut self,
fn from_curve_and_position(
curve: impl Into<MaybePartial<Curve>>,
position: impl Into<Point<1>>,
) -> &mut Self {
) -> Self {
let curve = curve.into().into_partial();
let path = curve.path.expect(
@ -67,7 +65,11 @@ impl GlobalVertexBuilder for PartialGlobalVertex {
);
let position_surface = path.point_from_path_coords(position);
self.update_from_surface_and_position(&surface, position_surface)
let mut global_vertex = PartialGlobalVertex::default();
global_vertex
.update_from_surface_and_position(&surface, position_surface);
global_vertex
}
fn update_from_surface_and_position(