New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3D OutlineExtractor doesn't work with polyhedrons with holes #45

maisonobe opened this Issue Sep 11, 2018 · 0 comments


None yet
1 participant
Copy link

maisonobe commented Sep 11, 2018

This test case fails. The 3D shape is a cube with square holes drilled along each axis.
The outline extracted when looking along the Z axis is empty, whereas it should be a big square
with a square hole in the middle.

public void testHolesInFacet() {
    double tolerance = 1.0e-10;
    PolyhedronsSet cube       = new PolyhedronsSet(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0, tolerance);
    PolyhedronsSet tubeAlongX = new PolyhedronsSet(-2.0, 2.0, -0.5, 0.5, -0.5, 0.5, tolerance);
    PolyhedronsSet tubeAlongY = new PolyhedronsSet(-0.5, 0.5, -2.0, 2.0, -0.5, 0.5, tolerance);
    PolyhedronsSet tubeAlongZ = new PolyhedronsSet(-0.5, 0.5, -0.5, 0.5, -2.0, 2.0, tolerance);
    RegionFactory<Euclidean3D> factory = new RegionFactory<>();
    PolyhedronsSet cubeWithHoles = (PolyhedronsSet) factory.difference(cube,
                                                                                     factory.union(tubeAlongY, tubeAlongZ)));
    Assert.assertEquals(4.0, cubeWithHoles.getSize(), 1.0e-10);
    Vector2D[][] outline = new OutlineExtractor(Vector3D.PLUS_I, Vector3D.PLUS_J).getOutline(cubeWithHoles);
    Assert.assertEquals(2, outline.length);
    Assert.assertEquals(4, outline[0].length);
    Assert.assertEquals(4, outline[1].length);

@maisonobe maisonobe self-assigned this Sep 11, 2018

@maisonobe maisonobe closed this in ebfac09 Sep 11, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment