Skip to content

Commit

Permalink
Merge pull request #1975 from hannobraun/edge
Browse files Browse the repository at this point in the history
Complete `UpdateHalfEdge`
  • Loading branch information
hannobraun authored Aug 1, 2023
2 parents b8f0da8 + ef9993e commit f3d3560
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions crates/fj-core/src/operations/update/edge.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
use fj_math::Point;

use crate::{
geometry::{CurveBoundary, SurfacePath},
objects::{Curve, GlobalEdge, HalfEdge, Vertex},
storage::Handle,
};

/// Update a [`HalfEdge`]
pub trait UpdateHalfEdge {
/// Replace the path of the half-edge
#[must_use]
fn replace_path(&self, path: SurfacePath) -> Self;

/// Replace the boundary of the half-edge
#[must_use]
fn replace_boundary(&self, boundary: CurveBoundary<Point<1>>) -> Self;

/// Replace the curve of the half-edge
#[must_use]
fn replace_curve(&self, curve: Handle<Curve>) -> Self;
Expand All @@ -19,6 +30,26 @@ pub trait UpdateHalfEdge {
}

impl UpdateHalfEdge for HalfEdge {
fn replace_path(&self, path: SurfacePath) -> Self {
HalfEdge::new(
path,
self.boundary(),
self.curve().clone(),
self.start_vertex().clone(),
self.global_form().clone(),
)
}

fn replace_boundary(&self, boundary: CurveBoundary<Point<1>>) -> Self {
HalfEdge::new(
self.path(),
boundary,
self.curve().clone(),
self.start_vertex().clone(),
self.global_form().clone(),
)
}

fn replace_curve(&self, curve: Handle<Curve>) -> Self {
HalfEdge::new(
self.path(),
Expand Down

0 comments on commit f3d3560

Please sign in to comment.