mirror of
https://github.com/hannobraun/Fornjot
synced 2025-10-05 07:27:57 +00:00
Return Handle
from UpdateHalfEdge::update_path
This commit is contained in:
parent
34ce68d89f
commit
f8038849d9
@ -9,13 +9,14 @@ use crate::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// Update a [`HalfEdge`]
|
/// Update a [`HalfEdge`]
|
||||||
pub trait UpdateHalfEdge {
|
pub trait UpdateHalfEdge: Sized {
|
||||||
/// Update the path of the edge
|
/// Update the path of the edge
|
||||||
#[must_use]
|
#[must_use]
|
||||||
fn update_path(
|
fn update_path(
|
||||||
&self,
|
&self,
|
||||||
update: impl FnOnce(SurfacePath) -> SurfacePath,
|
update: impl FnOnce(SurfacePath) -> SurfacePath,
|
||||||
) -> Self;
|
core: &mut Core,
|
||||||
|
) -> Handle<Self>;
|
||||||
|
|
||||||
/// Update the boundary of the edge
|
/// Update the boundary of the edge
|
||||||
#[must_use]
|
#[must_use]
|
||||||
@ -49,13 +50,15 @@ impl UpdateHalfEdge for HalfEdge {
|
|||||||
fn update_path(
|
fn update_path(
|
||||||
&self,
|
&self,
|
||||||
update: impl FnOnce(SurfacePath) -> SurfacePath,
|
update: impl FnOnce(SurfacePath) -> SurfacePath,
|
||||||
) -> Self {
|
core: &mut Core,
|
||||||
|
) -> Handle<Self> {
|
||||||
HalfEdge::new(
|
HalfEdge::new(
|
||||||
update(self.path()),
|
update(self.path()),
|
||||||
self.boundary(),
|
self.boundary(),
|
||||||
self.curve().clone(),
|
self.curve().clone(),
|
||||||
self.start_vertex().clone(),
|
self.start_vertex().clone(),
|
||||||
)
|
)
|
||||||
|
.insert(core)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_boundary(
|
fn update_boundary(
|
||||||
|
@ -429,9 +429,12 @@ mod tests {
|
|||||||
|cycle, core| {
|
|cycle, core| {
|
||||||
cycle.update_half_edge(
|
cycle.update_half_edge(
|
||||||
cycle.half_edges().nth_circular(0),
|
cycle.half_edges().nth_circular(0),
|
||||||
|edge, _| {
|
|edge, core| {
|
||||||
[edge
|
[edge
|
||||||
.update_path(|path| path.reverse())
|
.update_path(
|
||||||
|
|path| path.reverse(),
|
||||||
|
core,
|
||||||
|
)
|
||||||
.update_boundary(|boundary| {
|
.update_boundary(|boundary| {
|
||||||
boundary.reverse()
|
boundary.reverse()
|
||||||
})]
|
})]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user