mirror of
https://github.com/hannobraun/Fornjot
synced 2025-01-28 19:09:25 +00:00
Migrate update_path
to UpdateHalfEdgeGeometry
This commit is contained in:
parent
ec6d03b633
commit
38129b10ba
@ -1,2 +1,33 @@
|
|||||||
|
use crate::{
|
||||||
|
geometry::SurfacePath, objects::HalfEdge, operations::insert::Insert,
|
||||||
|
storage::Handle, Core,
|
||||||
|
};
|
||||||
|
|
||||||
/// Update the geometry of a [`HalfEdge`]
|
/// Update the geometry of a [`HalfEdge`]
|
||||||
pub trait UpdateHalfEdgeGeometry {}
|
pub trait UpdateHalfEdgeGeometry {
|
||||||
|
/// Update the path of the edge
|
||||||
|
#[must_use]
|
||||||
|
fn update_path(
|
||||||
|
&self,
|
||||||
|
update: impl FnOnce(SurfacePath) -> SurfacePath,
|
||||||
|
core: &mut Core,
|
||||||
|
) -> Self;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl UpdateHalfEdgeGeometry for Handle<HalfEdge> {
|
||||||
|
fn update_path(
|
||||||
|
&self,
|
||||||
|
update: impl FnOnce(SurfacePath) -> SurfacePath,
|
||||||
|
core: &mut Core,
|
||||||
|
) -> Self {
|
||||||
|
let path = update(self.path());
|
||||||
|
|
||||||
|
HalfEdge::new(
|
||||||
|
path,
|
||||||
|
self.boundary(),
|
||||||
|
self.curve().clone(),
|
||||||
|
self.start_vertex().clone(),
|
||||||
|
)
|
||||||
|
.insert(core)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use fj_math::Point;
|
use fj_math::Point;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
geometry::{CurveBoundary, SurfacePath},
|
geometry::CurveBoundary,
|
||||||
objects::{Curve, HalfEdge, Vertex},
|
objects::{Curve, HalfEdge, Vertex},
|
||||||
operations::{derive::DeriveFrom, insert::Insert},
|
operations::{derive::DeriveFrom, insert::Insert},
|
||||||
storage::Handle,
|
storage::Handle,
|
||||||
@ -10,14 +10,6 @@ use crate::{
|
|||||||
|
|
||||||
/// Update a [`HalfEdge`]
|
/// Update a [`HalfEdge`]
|
||||||
pub trait UpdateHalfEdge: Sized {
|
pub trait UpdateHalfEdge: Sized {
|
||||||
/// Update the path of the edge
|
|
||||||
#[must_use]
|
|
||||||
fn update_path(
|
|
||||||
&self,
|
|
||||||
update: impl FnOnce(SurfacePath) -> SurfacePath,
|
|
||||||
core: &mut Core,
|
|
||||||
) -> Handle<Self>;
|
|
||||||
|
|
||||||
/// Update the boundary of the edge
|
/// Update the boundary of the edge
|
||||||
#[must_use]
|
#[must_use]
|
||||||
fn update_boundary(
|
fn update_boundary(
|
||||||
@ -47,22 +39,6 @@ pub trait UpdateHalfEdge: Sized {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl UpdateHalfEdge for HalfEdge {
|
impl UpdateHalfEdge for HalfEdge {
|
||||||
fn update_path(
|
|
||||||
&self,
|
|
||||||
update: impl FnOnce(SurfacePath) -> SurfacePath,
|
|
||||||
core: &mut Core,
|
|
||||||
) -> Handle<Self> {
|
|
||||||
let path = update(self.path());
|
|
||||||
|
|
||||||
HalfEdge::new(
|
|
||||||
path,
|
|
||||||
self.boundary(),
|
|
||||||
self.curve().clone(),
|
|
||||||
self.start_vertex().clone(),
|
|
||||||
)
|
|
||||||
.insert(core)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn update_boundary(
|
fn update_boundary(
|
||||||
&self,
|
&self,
|
||||||
update: impl FnOnce(CurveBoundary<Point<1>>) -> CurveBoundary<Point<1>>,
|
update: impl FnOnce(CurveBoundary<Point<1>>) -> CurveBoundary<Point<1>>,
|
||||||
|
@ -403,6 +403,7 @@ mod tests {
|
|||||||
objects::{Curve, Shell},
|
objects::{Curve, Shell},
|
||||||
operations::{
|
operations::{
|
||||||
build::BuildShell,
|
build::BuildShell,
|
||||||
|
geometry::UpdateHalfEdgeGeometry,
|
||||||
update::{
|
update::{
|
||||||
UpdateCycle, UpdateFace, UpdateHalfEdge, UpdateRegion,
|
UpdateCycle, UpdateFace, UpdateHalfEdge, UpdateRegion,
|
||||||
UpdateShell,
|
UpdateShell,
|
||||||
|
Loading…
Reference in New Issue
Block a user