Closed hannobraun closed 1 year ago
I forgot to label this as https://github.com/hannobraun/Fornjot/labels/status%3A%20blocked in the first place.
I suspect that the missing triangles here are an instance of this bug:
This is basically the normal star model, except that the let radius = ...
line has been replaced with this:
let mut radius = if i % 2 == 0 { r1 } else { r2 };
radius *= (i + 1) as f64 / num_vertices as f64;
Here's a more minimal example:
#[fj::model]
pub fn model(
) -> fj::Shape {
let good_x = 0.5;
let bad_x = 0.4;
let x = bad_x;
let mut other = Vec::new();
other.push([0., 0.]);
other.push([x, 0.]);
other.push([0.4, 1.0]);
other.push([0.1, 0.1]);
other.push([0., 0.8]);
let other = fj::Sketch::from_points(other);
other.into()
}
Thank you, @willhansen!
Converted example to failing unit test: https://github.com/hannobraun/Fornjot/compare/main...willhansen:Fornjot:bugfix/%23430-triangulation-missing-edges
That's great, @willhansen, thank you!
Would you mind slapping an #[ignore]
on the test and submitting that in a pull request? That way, the test is available to be used right where it will be needed, without making the CI build fail.
It's possible that edges of a face don't show up in the triangulation, which is obviously an invalid result. It's relatively easy to come up with an example, once you know what to look for. Check out this quick sketch I did:
There's a face on the left, and a possible Delaunay triangulation of that face on the right. The long vertical edge that I specially marked is not present in the triangulation.
Thanks to @alexoro412, who reported this issue in #105!
This should be pretty easy to fix, hopefully. Spade can do constrained Delaunay triangulations, which should take care of this issue.
Blocked on #105, since I believe we should have a test suite in place before fixing more triangulation issues.