spade icon indicating copy to clipboard operation
spade copied to clipboard

Panic in `add_constraint_and_split`

Open Azorlogh opened this issue 6 months ago • 1 comments

This test case panics:

    #[test]
    fn edge_intersection_precision_test_3() -> Result<(), InsertionError> {
        let edges = [
            [
                Point2 {
                    x: 7.9910984,
                    y: -59.344463,
                },
                Point2 {
                    x: 15.484455,
                    y: -48.762936,
                },
            ],
            [
                Point2 {
                    x: 15.484455,
                    y: -48.762936,
                },
                Point2 {
                    x: -11.673287,
                    y: -28.37192,
                },
            ],
            [
                Point2 {
                    x: -11.673287,
                    y: -28.37192,
                },
                Point2 {
                    x: -16.214716,
                    y: -43.81278,
                },
            ],
            [
                Point2 {
                    x: -16.214716,
                    y: -43.81278,
                },
                Point2 {
                    x: -3.657666,
                    y: -51.41967,
                },
            ],
            [
                Point2 {
                    x: -3.657666,
                    y: -51.41967,
                },
                Point2 {
                    x: 7.9910984,
                    y: -59.344463,
                },
            ],
            [
                Point2 {
                    x: 7.4022045,
                    y: -51.355137,
                },
                Point2 {
                    x: 7.9910984,
                    y: -59.344463,
                },
            ],
            [
                Point2 {
                    x: 7.4022045,
                    y: -51.355137,
                },
                Point2 {
                    x: 15.484455,
                    y: -48.762936,
                },
            ],
            [
                Point2 {
                    x: 7.4022045,
                    y: -51.355137,
                },
                Point2 {
                    x: -13.92232,
                    y: -36.01863,
                },
            ],
        ];
        let mut cdt: ConstrainedDelaunayTriangulation<Point2<f32>> =
            ConstrainedDelaunayTriangulation::new();
        for edge in edges {
            let point_a = cdt.insert(edge[0])?;
            let point_b = cdt.insert(edge[1])?;
            cdt.cdt_sanity_check();
            cdt.add_constraint_and_split(point_a, point_b, |v| v);
            cdt.cdt_sanity_check();
        }

        Ok(())
    }
thread 'cdt::test::edge_intersection_precision_test_3' panicked at src/cdt.rs:876:17:
assertion `left != right` failed
  left: []
 right: []

It panics on this assertion: https://github.com/Stoeoef/spade/blob/bddafbb2a55ba22a8900931c13b80b1218d58fad/src/cdt.rs#L876

Azorlogh avatar Aug 22 '24 14:08 Azorlogh