Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add methods to access single HalfEdge vertices #1219

Merged
merged 3 commits into from
Oct 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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