Return Handle from UpdateHalfEdge::update_path

This commit is contained in:
Hanno Braun 2024-03-14 14:29:13 +01:00
parent 34ce68d89f
commit f8038849d9
2 changed files with 11 additions and 5 deletions

View File

@ -9,13 +9,14 @@ use crate::{
};
/// Update a [`HalfEdge`]
pub trait UpdateHalfEdge {
pub trait UpdateHalfEdge: Sized {
/// Update the path of the edge
#[must_use]
fn update_path(
&self,
update: impl FnOnce(SurfacePath) -> SurfacePath,
) -> Self;
core: &mut Core,
) -> Handle<Self>;
/// Update the boundary of the edge
#[must_use]
@ -49,13 +50,15 @@ impl UpdateHalfEdge for HalfEdge {
fn update_path(
&self,
update: impl FnOnce(SurfacePath) -> SurfacePath,
) -> Self {
core: &mut Core,
) -> Handle<Self> {
HalfEdge::new(
update(self.path()),
self.boundary(),
self.curve().clone(),
self.start_vertex().clone(),
)
.insert(core)
}
fn update_boundary(

View File

@ -429,9 +429,12 @@ mod tests {
|cycle, core| {
cycle.update_half_edge(
cycle.half_edges().nth_circular(0),
|edge, _| {
|edge, core| {
[edge
.update_path(|path| path.reverse())
.update_path(
|path| path.reverse(),
core,
)
.update_boundary(|boundary| {
boundary.reverse()
})]