Skip to content

Commit

Permalink
Simplify Edge reversal
Browse files Browse the repository at this point in the history
Keeps the old behavior where that is necessary, because a surface is
reversed.
  • Loading branch information
hannobraun committed Sep 8, 2022
1 parent 34a8ba1 commit 43cad28
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 19 deletions.
2 changes: 1 addition & 1 deletion crates/fj-kernel/src/algorithms/reverse/cycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ impl Reverse for Cycle {

let mut edges = self
.into_edges()
.map(|edge| edge.reverse())
.map(|edge| edge.reverse_including_curve())
.collect::<Vec<_>>();

edges.reverse();
Expand Down
2 changes: 1 addition & 1 deletion crates/fj-kernel/src/algorithms/reverse/edge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ use super::Reverse;

impl Reverse for Edge {
fn reverse(self) -> Self {
self.reverse_including_curve()
Edge::from_curve_and_vertices(*self.curve(), self.vertices().reverse())
}
}
2 changes: 1 addition & 1 deletion crates/fj-kernel/src/algorithms/sweep/edge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fn create_non_continuous_side_face(
color: Color,
) -> Face {
let edge = if path.is_negative_direction() {
edge.reverse()
edge.reverse_including_curve()
} else {
*edge
};
Expand Down
17 changes: 1 addition & 16 deletions crates/fj-kernel/src/objects/edge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,22 +239,7 @@ impl VerticesOfEdge<Vertex> {
///
/// Makes sure that the local coordinates are still correct.
pub fn reverse(self) -> Self {
Self(self.0.map(|[a, b]| {
[
Vertex::new(
-b.position(),
b.curve().reverse(),
*b.surface_form(),
*b.global_form(),
),
Vertex::new(
-a.position(),
a.curve().reverse(),
*a.surface_form(),
*a.global_form(),
),
]
}))
Self(self.0.map(|[a, b]| [b, a]))
}

/// Convert this instance into its global variant
Expand Down

0 comments on commit 43cad28

Please sign in to comment.