Skip to content

Commit

Permalink
Add ignored failing unit test for triangulation bug #430
Browse files Browse the repository at this point in the history
#430

Fix gitignore not ignoring .idea/ directory
  • Loading branch information
willhansen committed Jul 18, 2022
1 parent 7ae4838 commit ad5aaff
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
# IDE Configurations
**/.vs/ # Visual Studio
**/.idea/ # Intellij
.idea/
**/.buildconfig # Gnome Builder
43 changes: 43 additions & 0 deletions crates/fj-kernel/src/algorithms/triangulate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,49 @@ mod tests {
Ok(())
}

#[ignore]
#[test]
fn sharp_concave_shape() -> anyhow::Result<()> {
//
// c
// /|
// e / |
// |\ / |
// | | / |
// | \ / |
// | \ / |
// | d |
// a ---------- b
//

let a = Point::from([0., 0.]);
let b = Point::from([0.4, 0.]);
//let b = Point::from([0.5, 0.]); // test passes with this change
let c = Point::from([0.4, 1.0]);
let d = Point::from([0.1, 0.1]);
let e = Point::from([0., 0.8]);

let face = Face::builder(Surface::xy_plane())
.with_exterior_polygon([a, b, c, d, e])
.build();

let triangles = triangulate(face)?;

let a3 = a.to_xyz();
let b3 = b.to_xyz();
let c3 = c.to_xyz();
let d3 = d.to_xyz();
let e3 = e.to_xyz();

assert!(triangles.contains_triangle([a3, b3, d3]));
assert!(triangles.contains_triangle([b3, c3, d3]));
assert!(triangles.contains_triangle([a3, d3, e3]));

assert!(!triangles.contains_triangle([b3, e3, d3]));

Ok(())
}

fn triangulate(face: Face) -> anyhow::Result<Mesh<Point<3>>> {
let tolerance = Tolerance::from_scalar(Scalar::ONE)?;

Expand Down

0 comments on commit ad5aaff

Please sign in to comment.