Skip to content

Commit

Permalink
Merge pull request #1219 from hannobraun/half-edge
Browse files Browse the repository at this point in the history
Add methods to access single `HalfEdge` vertices
  • Loading branch information
hannobraun authored Oct 13, 2022
2 parents 045a2bc + be9a2f9 commit a6091e8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
12 changes: 12 additions & 0 deletions crates/fj-kernel/src/objects/edge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,18 @@ impl HalfEdge {
&self.vertices
}

/// Access the vertex at the back of the half-edge
pub fn back(&self) -> &Vertex {
let [back, _] = self.vertices();
back
}

/// Access the vertex at the front of the half-edge
pub fn front(&self) -> &Vertex {
let [_, front] = self.vertices();
front
}

/// Access the global form of this half-edge
pub fn global_form(&self) -> &GlobalEdge {
&self.global_form
Expand Down
2 changes: 1 addition & 1 deletion crates/fj-kernel/src/partial/objects/cycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ impl PartialCycle {

half_edge
.with_surface(Some(surface_for_edges.clone()))
.with_from_vertex(from)
.with_back_vertex(from)
})
.into_full(objects);

Expand Down
4 changes: 2 additions & 2 deletions crates/fj-kernel/src/partial/objects/edge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl PartialHalfEdge {
}

/// Update the partial half-edge with the given from vertex
pub fn with_from_vertex(
pub fn with_back_vertex(
mut self,
vertex: Option<impl Into<MaybePartial<Vertex>>>,
) -> Self {
Expand All @@ -73,7 +73,7 @@ impl PartialHalfEdge {
}

/// Update the partial half-edge with the given from vertex
pub fn with_to_vertex(
pub fn with_front_vertex(
mut self,
vertex: Option<impl Into<MaybePartial<Vertex>>>,
) -> Self {
Expand Down

0 comments on commit a6091e8

Please sign in to comment.