Skip to content

Commit

Permalink
Fix coherence issue in reverse
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed Jun 30, 2022
1 parent c4c9e7f commit 77f360b
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions crates/fj-kernel/src/algorithms/reverse.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use fj_math::{Circle, Line, Point, Vector};

use crate::{
objects::{Cycle, CyclesInFace, Edge, Face},
objects::{Curve, Cycle, CyclesInFace, Edge, Face},
shape::LocalForm,
};

Expand Down Expand Up @@ -33,16 +35,24 @@ fn reverse_local_coordinates_in_cycle(cycles: &CyclesInFace) -> CyclesInFace {
.iter()
.map(|edge| {
let curve = {
// This is wrong. We have reversed the direction of the
// surface, thereby modifying its coordinate system. So we
// can't just use the local form of the curve, which is
// expressed in surface coordinates, as-is.
//
// This is a coherence issue, but since coherence validation
// is not complete, and the whole local form stuff is still
// a work in progress, this doesn't lead to any observable
// bugs.
let local = *edge.local().curve.local();
let local = match *edge.local().curve.local() {
Curve::Circle(Circle { center, a, b }) => {
let center = Point::from([center.u, -center.v]);

let a = Vector::from([a.u, -a.v]);
let b = Vector::from([b.u, -b.v]);

Curve::Circle(Circle { center, a, b })
}
Curve::Line(Line { origin, direction }) => {
let origin = Point::from([origin.u, -origin.v]);
let direction =
Vector::from([direction.u, -direction.v]);

Curve::Line(Line { origin, direction })
}
};

let canonical = *edge.local().curve.canonical();
LocalForm::new(local, canonical)
};
Expand Down

0 comments on commit 77f360b

Please sign in to comment.