[jira] [Created] (MATH-780) BSPTree class and recovery of a Euclidean 3D BRep

classic Classic list List threaded Threaded
20 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (MATH-780) BSPTree class and recovery of a Euclidean 3D BRep

Gary D. Gregory (Jira)
BSPTree class and recovery of a Euclidean 3D BRep
-------------------------------------------------

                 Key: MATH-780
                 URL: https://issues.apache.org/jira/browse/MATH-780
             Project: Commons Math
          Issue Type: Bug
    Affects Versions: 3.0
         Environment: Linux
            Reporter: Andrew Willis


New to the work here. Thanks for your efforts on this code.

I create a BSPTree from a BoundaryRep (Brep) my test Brep is a tetrahedron as represented by a float array containing 4 3D points (x,y,z) order and an array of indices (4 triplets for the 4 faces of the tet). I construct a BSPMesh() as shown in the code below. I can construct the PolyhedronsSet() however, when I interrogate the shape (with getSize() or getBoundarySize() I get infinity back as a result). When I try to get back the BRep (by traversing the BSPTree resulting from PolyhedronsSet.getTree(true) and getting the PolygonsSet() associated with each 3D SubPlane, I get a null vertex back and strange values.

Any ideas?

public class BSPMesh {

    public BSPMesh(float[] coords, int[] indices) {
        double size;
        setBoundingBox(coords);
        ArrayList<SubHyperplane<Euclidean3D>> subHyperplaneList = new ArrayList();
        for (int idx = 0; idx < indices.length; idx += 3) {
            int idxA = indices[idx] * 3;
            int idxB = indices[idx + 1] * 3;
            int idxC = indices[idx + 2] * 3;
            Vector3D v_1 = new Vector3D(coords[idxA], coords[idxA + 1], coords[idxA + 2]);
            Vector3D v_2 = new Vector3D(coords[idxB], coords[idxB + 1], coords[idxB + 2]);
            Vector3D v_3 = new Vector3D(coords[idxC], coords[idxC + 1], coords[idxC + 2]);
            Vector3D[] vertices = {v_1, v_2, v_3};
            Plane polyPlane = new Plane(v_1, v_2, v_3);
            ArrayList<SubHyperplane<Euclidean2D>> lines = new ArrayList();

            Vector2D[] projPts = new Vector2D[vertices.length];
            for (int ptIdx=0; ptIdx < projPts.length; ptIdx++) {
                projPts[ptIdx] = polyPlane.toSubSpace(vertices[ptIdx]);
            }

            SubLine lineInPlane = null;
            for (int ptIdx=0; ptIdx < projPts.length; ptIdx++) {
                lineInPlane = new SubLine(projPts[ptIdx], projPts[(ptIdx+1)%projPts.length]);
                lines.add(lineInPlane);
            }
            Region<Euclidean2D> polyRegion = new PolygonsSet(lines);
            SubPlane polygon = new SubPlane(polyPlane, polyRegion);
            size = polyRegion.getSize(); // correct size here
            Vector3D[][] verticesTest = getVertices(polygon); // correctly retrieves the BRep for each face
            subHyperplaneList.add(polygon);
        }
        PolyhedronsSet polyhedronsSet = new PolyhedronsSet(subHyperplaneList);
        BSPTree<Euclidean3D> myTree = polyhedronsSet.getTree(true);
        size = polyhedronsSet.getSize();        // strange Inf returned
        size = polyhedronsSet2.getBoundarySize();         // strange Inf returned
        tree = myTree;
        Vector3D[][] vertices = getVertices((SubPlane) ((BoundaryAttribute) tree.getAttribute()).getPlusOutside()); // strange values returned here
        System.out.println("END");
    }

    public static void main(String[] args) {
            float[] tetCoords = {1, 0, 0,
                2, 0, 0,
                1, 1, 0,
                1, 0, 1};
            int[] tetIndices = {0, 1, 2,
                0, 1, 3,
                0, 2, 3,
                2, 1, 3};
            BSPMesh blah = new BSPMesh(tetCoords, tetIndices);
     }
}



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (MATH-780) BSPTree class and recovery of a Euclidean 3D BRep

Gary D. Gregory (Jira)

     [ https://issues.apache.org/jira/browse/MATH-780?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Willis updated MATH-780:
-------------------------------

    Description:
New to the work here. Thanks for your efforts on this code.

I create a BSPTree from a BoundaryRep (Brep) my test Brep is a tetrahedron as represented by a float array containing 4 3D points (x,y,z) order and an array of indices (4 triplets for the 4 faces of the tet). I construct a BSPMesh() as shown in the code below. I can construct the PolyhedronsSet() however, when I interrogate the shape (with getSize() or getBoundarySize() I get infinity back as a result). When I try to get back the BRep (by traversing the BSPTree resulting from PolyhedronsSet.getTree(true) and getting the PolygonsSet() associated with each 3D SubPlane, I get a null vertex back and strange values.

Any ideas?

public class BSPMesh {

    public BSPMesh(float[] coords, int[] indices) {
        double size;
        setBoundingBox(coords);
        ArrayList<SubHyperplane<Euclidean3D>> subHyperplaneList = new ArrayList();
        for (int idx = 0; idx < indices.length; idx += 3) {
            int idxA = indices[idx] * 3;
            int idxB = indices[idx + 1] * 3;
            int idxC = indices[idx + 2] * 3;
            Vector3D v_1 = new Vector3D(coords[idxA], coords[idxA + 1], coords[idxA + 2]);
            Vector3D v_2 = new Vector3D(coords[idxB], coords[idxB + 1], coords[idxB + 2]);
            Vector3D v_3 = new Vector3D(coords[idxC], coords[idxC + 1], coords[idxC + 2]);
            Vector3D[] vertices = {v_1, v_2, v_3};
            Plane polyPlane = new Plane(v_1, v_2, v_3);
            ArrayList<SubHyperplane<Euclidean2D>> lines = new ArrayList();

            Vector2D[] projPts = new Vector2D[vertices.length];
            for (int ptIdx=0; ptIdx < projPts.length; ptIdx++) {
                projPts[ptIdx] = polyPlane.toSubSpace(vertices[ptIdx]);
            }

            SubLine lineInPlane = null;
            for (int ptIdx=0; ptIdx < projPts.length; ptIdx++) {
                lineInPlane = new SubLine(projPts[ptIdx], projPts[(ptIdx+1)%projPts.length]);
                lines.add(lineInPlane);
            }
            Region<Euclidean2D> polyRegion = new PolygonsSet(lines);
            SubPlane polygon = new SubPlane(polyPlane, polyRegion);
            size = polyRegion.getSize(); // correct size here
            Vector3D[][] verticesTest = getVertices(polygon); // correctly retrieves the BRep for each face
            subHyperplaneList.add(polygon);
        }
        PolyhedronsSet polyhedronsSet = new PolyhedronsSet(subHyperplaneList);
        BSPTree<Euclidean3D> myTree = polyhedronsSet.getTree(true);
        size = polyhedronsSet.getSize();        // strange Inf returned
        size = polyhedronsSet2.getBoundarySize();         // strange Inf returned
        // Member variable and other code for extracting the BRep not included here... can include if desired
        //tree = myTree;
        //Vector3D[][] vertices = getVertices((SubPlane) ((BoundaryAttribute) tree.getAttribute()).getPlusOutside()); // strange values returned here
        System.out.println("END");
    }

    public static void main(String[] args) {
            float[] tetCoords = {1, 0, 0,
                2, 0, 0,
                1, 1, 0,
                1, 0, 1};
            int[] tetIndices = {0, 1, 2,
                0, 1, 3,
                0, 2, 3,
                2, 1, 3};
            BSPMesh blah = new BSPMesh(tetCoords, tetIndices);
     }
}



  was:
New to the work here. Thanks for your efforts on this code.

I create a BSPTree from a BoundaryRep (Brep) my test Brep is a tetrahedron as represented by a float array containing 4 3D points (x,y,z) order and an array of indices (4 triplets for the 4 faces of the tet). I construct a BSPMesh() as shown in the code below. I can construct the PolyhedronsSet() however, when I interrogate the shape (with getSize() or getBoundarySize() I get infinity back as a result). When I try to get back the BRep (by traversing the BSPTree resulting from PolyhedronsSet.getTree(true) and getting the PolygonsSet() associated with each 3D SubPlane, I get a null vertex back and strange values.

Any ideas?

public class BSPMesh {

    public BSPMesh(float[] coords, int[] indices) {
        double size;
        setBoundingBox(coords);
        ArrayList<SubHyperplane<Euclidean3D>> subHyperplaneList = new ArrayList();
        for (int idx = 0; idx < indices.length; idx += 3) {
            int idxA = indices[idx] * 3;
            int idxB = indices[idx + 1] * 3;
            int idxC = indices[idx + 2] * 3;
            Vector3D v_1 = new Vector3D(coords[idxA], coords[idxA + 1], coords[idxA + 2]);
            Vector3D v_2 = new Vector3D(coords[idxB], coords[idxB + 1], coords[idxB + 2]);
            Vector3D v_3 = new Vector3D(coords[idxC], coords[idxC + 1], coords[idxC + 2]);
            Vector3D[] vertices = {v_1, v_2, v_3};
            Plane polyPlane = new Plane(v_1, v_2, v_3);
            ArrayList<SubHyperplane<Euclidean2D>> lines = new ArrayList();

            Vector2D[] projPts = new Vector2D[vertices.length];
            for (int ptIdx=0; ptIdx < projPts.length; ptIdx++) {
                projPts[ptIdx] = polyPlane.toSubSpace(vertices[ptIdx]);
            }

            SubLine lineInPlane = null;
            for (int ptIdx=0; ptIdx < projPts.length; ptIdx++) {
                lineInPlane = new SubLine(projPts[ptIdx], projPts[(ptIdx+1)%projPts.length]);
                lines.add(lineInPlane);
            }
            Region<Euclidean2D> polyRegion = new PolygonsSet(lines);
            SubPlane polygon = new SubPlane(polyPlane, polyRegion);
            size = polyRegion.getSize(); // correct size here
            Vector3D[][] verticesTest = getVertices(polygon); // correctly retrieves the BRep for each face
            subHyperplaneList.add(polygon);
        }
        PolyhedronsSet polyhedronsSet = new PolyhedronsSet(subHyperplaneList);
        BSPTree<Euclidean3D> myTree = polyhedronsSet.getTree(true);
        size = polyhedronsSet.getSize();        // strange Inf returned
        size = polyhedronsSet2.getBoundarySize();         // strange Inf returned
        tree = myTree;
        Vector3D[][] vertices = getVertices((SubPlane) ((BoundaryAttribute) tree.getAttribute()).getPlusOutside()); // strange values returned here
        System.out.println("END");
    }

    public static void main(String[] args) {
            float[] tetCoords = {1, 0, 0,
                2, 0, 0,
                1, 1, 0,
                1, 0, 1};
            int[] tetIndices = {0, 1, 2,
                0, 1, 3,
                0, 2, 3,
                2, 1, 3};
            BSPMesh blah = new BSPMesh(tetCoords, tetIndices);
     }
}



   

> BSPTree class and recovery of a Euclidean 3D BRep
> -------------------------------------------------
>
>                 Key: MATH-780
>                 URL: https://issues.apache.org/jira/browse/MATH-780
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>         Environment: Linux
>            Reporter: Andrew Willis
>              Labels: BSPTree, euclidean.threed
>
> New to the work here. Thanks for your efforts on this code.
> I create a BSPTree from a BoundaryRep (Brep) my test Brep is a tetrahedron as represented by a float array containing 4 3D points (x,y,z) order and an array of indices (4 triplets for the 4 faces of the tet). I construct a BSPMesh() as shown in the code below. I can construct the PolyhedronsSet() however, when I interrogate the shape (with getSize() or getBoundarySize() I get infinity back as a result). When I try to get back the BRep (by traversing the BSPTree resulting from PolyhedronsSet.getTree(true) and getting the PolygonsSet() associated with each 3D SubPlane, I get a null vertex back and strange values.
> Any ideas?
> public class BSPMesh {
>     public BSPMesh(float[] coords, int[] indices) {
>         double size;
>         setBoundingBox(coords);
>         ArrayList<SubHyperplane<Euclidean3D>> subHyperplaneList = new ArrayList();
>         for (int idx = 0; idx < indices.length; idx += 3) {
>             int idxA = indices[idx] * 3;
>             int idxB = indices[idx + 1] * 3;
>             int idxC = indices[idx + 2] * 3;
>             Vector3D v_1 = new Vector3D(coords[idxA], coords[idxA + 1], coords[idxA + 2]);
>             Vector3D v_2 = new Vector3D(coords[idxB], coords[idxB + 1], coords[idxB + 2]);
>             Vector3D v_3 = new Vector3D(coords[idxC], coords[idxC + 1], coords[idxC + 2]);
>             Vector3D[] vertices = {v_1, v_2, v_3};
>             Plane polyPlane = new Plane(v_1, v_2, v_3);
>             ArrayList<SubHyperplane<Euclidean2D>> lines = new ArrayList();
>             Vector2D[] projPts = new Vector2D[vertices.length];
>             for (int ptIdx=0; ptIdx < projPts.length; ptIdx++) {
>                 projPts[ptIdx] = polyPlane.toSubSpace(vertices[ptIdx]);
>             }
>             SubLine lineInPlane = null;
>             for (int ptIdx=0; ptIdx < projPts.length; ptIdx++) {
>                 lineInPlane = new SubLine(projPts[ptIdx], projPts[(ptIdx+1)%projPts.length]);
>                 lines.add(lineInPlane);
>             }
>             Region<Euclidean2D> polyRegion = new PolygonsSet(lines);
>             SubPlane polygon = new SubPlane(polyPlane, polyRegion);
>             size = polyRegion.getSize(); // correct size here
>             Vector3D[][] verticesTest = getVertices(polygon); // correctly retrieves the BRep for each face
>             subHyperplaneList.add(polygon);
>         }
>         PolyhedronsSet polyhedronsSet = new PolyhedronsSet(subHyperplaneList);
>         BSPTree<Euclidean3D> myTree = polyhedronsSet.getTree(true);
>         size = polyhedronsSet.getSize();        // strange Inf returned
>         size = polyhedronsSet2.getBoundarySize();         // strange Inf returned
>         // Member variable and other code for extracting the BRep not included here... can include if desired
>         //tree = myTree;
>         //Vector3D[][] vertices = getVertices((SubPlane) ((BoundaryAttribute) tree.getAttribute()).getPlusOutside()); // strange values returned here
>         System.out.println("END");
>     }
>     public static void main(String[] args) {
>             float[] tetCoords = {1, 0, 0,
>                 2, 0, 0,
>                 1, 1, 0,
>                 1, 0, 1};
>             int[] tetIndices = {0, 1, 2,
>                 0, 1, 3,
>                 0, 2, 3,
>                 2, 1, 3};
>             BSPMesh blah = new BSPMesh(tetCoords, tetIndices);
>      }
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (MATH-780) BSPTree class and recovery of a Euclidean 3D BRep

Gary D. Gregory (Jira)
In reply to this post by Gary D. Gregory (Jira)

    [ https://issues.apache.org/jira/browse/MATH-780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13258342#comment-13258342 ]

Andrew Willis commented on MATH-780:
------------------------------------

Looks like I had an index flipped resulting in an improperly oriented face for the tetrahedron. I did get the tetrahedron to work. However, I am now struggling with getting a cube to work and I have verified the normals/orientations of the planes to be correct.
               

> BSPTree class and recovery of a Euclidean 3D BRep
> -------------------------------------------------
>
>                 Key: MATH-780
>                 URL: https://issues.apache.org/jira/browse/MATH-780
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>         Environment: Linux
>            Reporter: Andrew Willis
>              Labels: BSPTree, euclidean.threed
>
> New to the work here. Thanks for your efforts on this code.
> I create a BSPTree from a BoundaryRep (Brep) my test Brep is a tetrahedron as represented by a float array containing 4 3D points (x,y,z) order and an array of indices (4 triplets for the 4 faces of the tet). I construct a BSPMesh() as shown in the code below. I can construct the PolyhedronsSet() however, when I interrogate the shape (with getSize() or getBoundarySize() I get infinity back as a result). When I try to get back the BRep (by traversing the BSPTree resulting from PolyhedronsSet.getTree(true) and getting the PolygonsSet() associated with each 3D SubPlane, I get a null vertex back and strange values.
> Any ideas?
> public class BSPMesh {
>     public BSPMesh(float[] coords, int[] indices) {
>         double size;
>         setBoundingBox(coords);
>         ArrayList<SubHyperplane<Euclidean3D>> subHyperplaneList = new ArrayList();
>         for (int idx = 0; idx < indices.length; idx += 3) {
>             int idxA = indices[idx] * 3;
>             int idxB = indices[idx + 1] * 3;
>             int idxC = indices[idx + 2] * 3;
>             Vector3D v_1 = new Vector3D(coords[idxA], coords[idxA + 1], coords[idxA + 2]);
>             Vector3D v_2 = new Vector3D(coords[idxB], coords[idxB + 1], coords[idxB + 2]);
>             Vector3D v_3 = new Vector3D(coords[idxC], coords[idxC + 1], coords[idxC + 2]);
>             Vector3D[] vertices = {v_1, v_2, v_3};
>             Plane polyPlane = new Plane(v_1, v_2, v_3);
>             ArrayList<SubHyperplane<Euclidean2D>> lines = new ArrayList();
>             Vector2D[] projPts = new Vector2D[vertices.length];
>             for (int ptIdx=0; ptIdx < projPts.length; ptIdx++) {
>                 projPts[ptIdx] = polyPlane.toSubSpace(vertices[ptIdx]);
>             }
>             SubLine lineInPlane = null;
>             for (int ptIdx=0; ptIdx < projPts.length; ptIdx++) {
>                 lineInPlane = new SubLine(projPts[ptIdx], projPts[(ptIdx+1)%projPts.length]);
>                 lines.add(lineInPlane);
>             }
>             Region<Euclidean2D> polyRegion = new PolygonsSet(lines);
>             SubPlane polygon = new SubPlane(polyPlane, polyRegion);
>             size = polyRegion.getSize(); // correct size here
>             Vector3D[][] verticesTest = getVertices(polygon); // correctly retrieves the BRep for each face
>             subHyperplaneList.add(polygon);
>         }
>         PolyhedronsSet polyhedronsSet = new PolyhedronsSet(subHyperplaneList);
>         BSPTree<Euclidean3D> myTree = polyhedronsSet.getTree(true);
>         size = polyhedronsSet.getSize();        // strange Inf returned
>         size = polyhedronsSet2.getBoundarySize();         // strange Inf returned
>         // Member variable and other code for extracting the BRep not included here... can include if desired
>         //tree = myTree;
>         //Vector3D[][] vertices = getVertices((SubPlane) ((BoundaryAttribute) tree.getAttribute()).getPlusOutside()); // strange values returned here
>         System.out.println("END");
>     }
>     public static void main(String[] args) {
>             float[] tetCoords = {1, 0, 0,
>                 2, 0, 0,
>                 1, 1, 0,
>                 1, 0, 1};
>             int[] tetIndices = {0, 1, 2,
>                 0, 1, 3,
>                 0, 2, 3,
>                 2, 1, 3};
>             BSPMesh blah = new BSPMesh(tetCoords, tetIndices);
>      }
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (MATH-780) BSPTree class and recovery of a Euclidean 3D BRep

Gary D. Gregory (Jira)
In reply to this post by Gary D. Gregory (Jira)

     [ https://issues.apache.org/jira/browse/MATH-780?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Willis updated MATH-780:
-------------------------------

    Attachment: BSPMesh2.java

This code produces the following error:

Exception in thread "main" java.lang.ClassCastException: org.apache.commons.math3.geometry.partitioning.BoundaryAttribute cannot be cast to java.lang.Boolean
        at org.apache.commons.math3.geometry.euclidean.twod_exact.PolygonsSet.computeGeometricalProperties(PolygonsSet.java:135)
        at org.apache.commons.math3.geometry.partitioning.AbstractRegion.getSize(AbstractRegion.java:380)
        at org.apache.commons.math3.geometry.euclidean.threed_exact.PolyhedronsSet$FacetsContributionVisitor.addContribution(PolyhedronsSet.java:171)
        at org.apache.commons.math3.geometry.euclidean.threed_exact.PolyhedronsSet$FacetsContributionVisitor.visitInternalNode(PolyhedronsSet.java:153)
        at org.apache.commons.math3.geometry.partitioning.BSPTree.visit(BSPTree.java:262)
        at org.apache.commons.math3.geometry.partitioning.BSPTree.visit(BSPTree.java:261)
        at org.apache.commons.math3.geometry.partitioning.BSPTree.visit(BSPTree.java:261)
        at org.apache.commons.math3.geometry.partitioning.BSPTree.visit(BSPTree.java:263)
        at org.apache.commons.math3.geometry.partitioning.BSPTree.visit(BSPTree.java:261)
        at org.apache.commons.math3.geometry.euclidean.threed_exact.PolyhedronsSet.computeGeometricalProperties(PolyhedronsSet.java:118)
        at org.apache.commons.math3.geometry.partitioning.AbstractRegion.getSize(AbstractRegion.java:380)
        at datastructures.j3d.bsptree.BSPMesh.<init>(BSPMesh.java:130)
        at datastructures.j3d.bsptree.BSPMesh2.main(BSPMesh2.java:206)

               

> BSPTree class and recovery of a Euclidean 3D BRep
> -------------------------------------------------
>
>                 Key: MATH-780
>                 URL: https://issues.apache.org/jira/browse/MATH-780
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>         Environment: Linux
>            Reporter: Andrew Willis
>              Labels: BSPTree, euclidean.threed
>         Attachments: BSPMesh2.java
>
>
> New to the work here. Thanks for your efforts on this code.
> I create a BSPTree from a BoundaryRep (Brep) my test Brep is a tetrahedron as represented by a float array containing 4 3D points (x,y,z) order and an array of indices (4 triplets for the 4 faces of the tet). I construct a BSPMesh() as shown in the code below. I can construct the PolyhedronsSet() however, when I interrogate the shape (with getSize() or getBoundarySize() I get infinity back as a result). When I try to get back the BRep (by traversing the BSPTree resulting from PolyhedronsSet.getTree(true) and getting the PolygonsSet() associated with each 3D SubPlane, I get a null vertex back and strange values.
> Any ideas?
> public class BSPMesh {
>     public BSPMesh(float[] coords, int[] indices) {
>         double size;
>         setBoundingBox(coords);
>         ArrayList<SubHyperplane<Euclidean3D>> subHyperplaneList = new ArrayList();
>         for (int idx = 0; idx < indices.length; idx += 3) {
>             int idxA = indices[idx] * 3;
>             int idxB = indices[idx + 1] * 3;
>             int idxC = indices[idx + 2] * 3;
>             Vector3D v_1 = new Vector3D(coords[idxA], coords[idxA + 1], coords[idxA + 2]);
>             Vector3D v_2 = new Vector3D(coords[idxB], coords[idxB + 1], coords[idxB + 2]);
>             Vector3D v_3 = new Vector3D(coords[idxC], coords[idxC + 1], coords[idxC + 2]);
>             Vector3D[] vertices = {v_1, v_2, v_3};
>             Plane polyPlane = new Plane(v_1, v_2, v_3);
>             ArrayList<SubHyperplane<Euclidean2D>> lines = new ArrayList();
>             Vector2D[] projPts = new Vector2D[vertices.length];
>             for (int ptIdx=0; ptIdx < projPts.length; ptIdx++) {
>                 projPts[ptIdx] = polyPlane.toSubSpace(vertices[ptIdx]);
>             }
>             SubLine lineInPlane = null;
>             for (int ptIdx=0; ptIdx < projPts.length; ptIdx++) {
>                 lineInPlane = new SubLine(projPts[ptIdx], projPts[(ptIdx+1)%projPts.length]);
>                 lines.add(lineInPlane);
>             }
>             Region<Euclidean2D> polyRegion = new PolygonsSet(lines);
>             SubPlane polygon = new SubPlane(polyPlane, polyRegion);
>             size = polyRegion.getSize(); // correct size here
>             Vector3D[][] verticesTest = getVertices(polygon); // correctly retrieves the BRep for each face
>             subHyperplaneList.add(polygon);
>         }
>         PolyhedronsSet polyhedronsSet = new PolyhedronsSet(subHyperplaneList);
>         BSPTree<Euclidean3D> myTree = polyhedronsSet.getTree(true);
>         size = polyhedronsSet.getSize();        // strange Inf returned
>         size = polyhedronsSet2.getBoundarySize();         // strange Inf returned
>         // Member variable and other code for extracting the BRep not included here... can include if desired
>         //tree = myTree;
>         //Vector3D[][] vertices = getVertices((SubPlane) ((BoundaryAttribute) tree.getAttribute()).getPlusOutside()); // strange values returned here
>         System.out.println("END");
>     }
>     public static void main(String[] args) {
>             float[] tetCoords = {1, 0, 0,
>                 2, 0, 0,
>                 1, 1, 0,
>                 1, 0, 1};
>             int[] tetIndices = {0, 1, 2,
>                 0, 1, 3,
>                 0, 2, 3,
>                 2, 1, 3};
>             BSPMesh blah = new BSPMesh(tetCoords, tetIndices);
>      }
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Issue Comment Edited] (MATH-780) BSPTree class and recovery of a Euclidean 3D BRep

Gary D. Gregory (Jira)
In reply to this post by Gary D. Gregory (Jira)

    [ https://issues.apache.org/jira/browse/MATH-780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13258362#comment-13258362 ]

Andrew Willis edited comment on MATH-780 at 4/20/12 4:42 PM:
-------------------------------------------------------------

The code in BSPMesh2.java produces the following error when I run it. If you comment in the line that re-assigns the coordinate data to be cubeCoords1, then the code works fine. The only difference in the two data sets is that one coordinate has changed by a small amount.

Exception in thread "main" java.lang.ClassCastException: org.apache.commons.math3.geometry.partitioning.BoundaryAttribute cannot be cast to java.lang.Boolean
        at org.apache.commons.math3.geometry.euclidean.twod_exact.PolygonsSet.computeGeometricalProperties(PolygonsSet.java:135)
        at org.apache.commons.math3.geometry.partitioning.AbstractRegion.getSize(AbstractRegion.java:380)
        at org.apache.commons.math3.geometry.euclidean.threed_exact.PolyhedronsSet$FacetsContributionVisitor.addContribution(PolyhedronsSet.java:171)
        at org.apache.commons.math3.geometry.euclidean.threed_exact.PolyhedronsSet$FacetsContributionVisitor.visitInternalNode(PolyhedronsSet.java:153)
        at org.apache.commons.math3.geometry.partitioning.BSPTree.visit(BSPTree.java:262)
        at org.apache.commons.math3.geometry.partitioning.BSPTree.visit(BSPTree.java:261)
        at org.apache.commons.math3.geometry.partitioning.BSPTree.visit(BSPTree.java:261)
        at org.apache.commons.math3.geometry.partitioning.BSPTree.visit(BSPTree.java:263)
        at org.apache.commons.math3.geometry.partitioning.BSPTree.visit(BSPTree.java:261)
        at org.apache.commons.math3.geometry.euclidean.threed_exact.PolyhedronsSet.computeGeometricalProperties(PolyhedronsSet.java:118)
        at org.apache.commons.math3.geometry.partitioning.AbstractRegion.getSize(AbstractRegion.java:380)
        at datastructures.j3d.bsptree.BSPMesh.<init>(BSPMesh.java:130)
        at datastructures.j3d.bsptree.BSPMesh2.main(BSPMesh2.java:206)

               
      was (Author: arwillis):
    This code produces the following error:

Exception in thread "main" java.lang.ClassCastException: org.apache.commons.math3.geometry.partitioning.BoundaryAttribute cannot be cast to java.lang.Boolean
        at org.apache.commons.math3.geometry.euclidean.twod_exact.PolygonsSet.computeGeometricalProperties(PolygonsSet.java:135)
        at org.apache.commons.math3.geometry.partitioning.AbstractRegion.getSize(AbstractRegion.java:380)
        at org.apache.commons.math3.geometry.euclidean.threed_exact.PolyhedronsSet$FacetsContributionVisitor.addContribution(PolyhedronsSet.java:171)
        at org.apache.commons.math3.geometry.euclidean.threed_exact.PolyhedronsSet$FacetsContributionVisitor.visitInternalNode(PolyhedronsSet.java:153)
        at org.apache.commons.math3.geometry.partitioning.BSPTree.visit(BSPTree.java:262)
        at org.apache.commons.math3.geometry.partitioning.BSPTree.visit(BSPTree.java:261)
        at org.apache.commons.math3.geometry.partitioning.BSPTree.visit(BSPTree.java:261)
        at org.apache.commons.math3.geometry.partitioning.BSPTree.visit(BSPTree.java:263)
        at org.apache.commons.math3.geometry.partitioning.BSPTree.visit(BSPTree.java:261)
        at org.apache.commons.math3.geometry.euclidean.threed_exact.PolyhedronsSet.computeGeometricalProperties(PolyhedronsSet.java:118)
        at org.apache.commons.math3.geometry.partitioning.AbstractRegion.getSize(AbstractRegion.java:380)
        at datastructures.j3d.bsptree.BSPMesh.<init>(BSPMesh.java:130)
        at datastructures.j3d.bsptree.BSPMesh2.main(BSPMesh2.java:206)

                 

> BSPTree class and recovery of a Euclidean 3D BRep
> -------------------------------------------------
>
>                 Key: MATH-780
>                 URL: https://issues.apache.org/jira/browse/MATH-780
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>         Environment: Linux
>            Reporter: Andrew Willis
>              Labels: BSPTree, euclidean.threed
>         Attachments: BSPMesh2.java
>
>
> New to the work here. Thanks for your efforts on this code.
> I create a BSPTree from a BoundaryRep (Brep) my test Brep is a tetrahedron as represented by a float array containing 4 3D points (x,y,z) order and an array of indices (4 triplets for the 4 faces of the tet). I construct a BSPMesh() as shown in the code below. I can construct the PolyhedronsSet() however, when I interrogate the shape (with getSize() or getBoundarySize() I get infinity back as a result). When I try to get back the BRep (by traversing the BSPTree resulting from PolyhedronsSet.getTree(true) and getting the PolygonsSet() associated with each 3D SubPlane, I get a null vertex back and strange values.
> Any ideas?
> public class BSPMesh {
>     public BSPMesh(float[] coords, int[] indices) {
>         double size;
>         setBoundingBox(coords);
>         ArrayList<SubHyperplane<Euclidean3D>> subHyperplaneList = new ArrayList();
>         for (int idx = 0; idx < indices.length; idx += 3) {
>             int idxA = indices[idx] * 3;
>             int idxB = indices[idx + 1] * 3;
>             int idxC = indices[idx + 2] * 3;
>             Vector3D v_1 = new Vector3D(coords[idxA], coords[idxA + 1], coords[idxA + 2]);
>             Vector3D v_2 = new Vector3D(coords[idxB], coords[idxB + 1], coords[idxB + 2]);
>             Vector3D v_3 = new Vector3D(coords[idxC], coords[idxC + 1], coords[idxC + 2]);
>             Vector3D[] vertices = {v_1, v_2, v_3};
>             Plane polyPlane = new Plane(v_1, v_2, v_3);
>             ArrayList<SubHyperplane<Euclidean2D>> lines = new ArrayList();
>             Vector2D[] projPts = new Vector2D[vertices.length];
>             for (int ptIdx=0; ptIdx < projPts.length; ptIdx++) {
>                 projPts[ptIdx] = polyPlane.toSubSpace(vertices[ptIdx]);
>             }
>             SubLine lineInPlane = null;
>             for (int ptIdx=0; ptIdx < projPts.length; ptIdx++) {
>                 lineInPlane = new SubLine(projPts[ptIdx], projPts[(ptIdx+1)%projPts.length]);
>                 lines.add(lineInPlane);
>             }
>             Region<Euclidean2D> polyRegion = new PolygonsSet(lines);
>             SubPlane polygon = new SubPlane(polyPlane, polyRegion);
>             size = polyRegion.getSize(); // correct size here
>             Vector3D[][] verticesTest = getVertices(polygon); // correctly retrieves the BRep for each face
>             subHyperplaneList.add(polygon);
>         }
>         PolyhedronsSet polyhedronsSet = new PolyhedronsSet(subHyperplaneList);
>         BSPTree<Euclidean3D> myTree = polyhedronsSet.getTree(true);
>         size = polyhedronsSet.getSize();        // strange Inf returned
>         size = polyhedronsSet2.getBoundarySize();         // strange Inf returned
>         // Member variable and other code for extracting the BRep not included here... can include if desired
>         //tree = myTree;
>         //Vector3D[][] vertices = getVertices((SubPlane) ((BoundaryAttribute) tree.getAttribute()).getPlusOutside()); // strange values returned here
>         System.out.println("END");
>     }
>     public static void main(String[] args) {
>             float[] tetCoords = {1, 0, 0,
>                 2, 0, 0,
>                 1, 1, 0,
>                 1, 0, 1};
>             int[] tetIndices = {0, 1, 2,
>                 0, 1, 3,
>                 0, 2, 3,
>                 2, 1, 3};
>             BSPMesh blah = new BSPMesh(tetCoords, tetIndices);
>      }
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (MATH-780) BSPTree class and recovery of a Euclidean 3D BRep

Gary D. Gregory (Jira)
In reply to this post by Gary D. Gregory (Jira)

     [ https://issues.apache.org/jira/browse/MATH-780?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Willis updated MATH-780:
-------------------------------

    Description:
New to the work here. Thanks for your efforts on this code.

I create a BSPTree from a BoundaryRep (Brep) my test Brep is a cube as represented by a float array containing 8 3D points in(x,y,z) order and an array of indices (12 triplets for the 12 faces of the cube). I construct a BSPMesh() as shown in the code below. I can construct the PolyhedronsSet() but have problems extracting the faces from the BSPTree to reconstruct the BRep. The attached code (BSPMesh2.java) shows that a small change to 1 of the vertex positions causes/corrects the problem.

Any ideas?


  was:
New to the work here. Thanks for your efforts on this code.

I create a BSPTree from a BoundaryRep (Brep) my test Brep is a tetrahedron as represented by a float array containing 4 3D points (x,y,z) order and an array of indices (4 triplets for the 4 faces of the tet). I construct a BSPMesh() as shown in the code below. I can construct the PolyhedronsSet() however, when I interrogate the shape (with getSize() or getBoundarySize() I get infinity back as a result). When I try to get back the BRep (by traversing the BSPTree resulting from PolyhedronsSet.getTree(true) and getting the PolygonsSet() associated with each 3D SubPlane, I get a null vertex back and strange values.

Any ideas?

public class BSPMesh {

    public BSPMesh(float[] coords, int[] indices) {
        double size;
        setBoundingBox(coords);
        ArrayList<SubHyperplane<Euclidean3D>> subHyperplaneList = new ArrayList();
        for (int idx = 0; idx < indices.length; idx += 3) {
            int idxA = indices[idx] * 3;
            int idxB = indices[idx + 1] * 3;
            int idxC = indices[idx + 2] * 3;
            Vector3D v_1 = new Vector3D(coords[idxA], coords[idxA + 1], coords[idxA + 2]);
            Vector3D v_2 = new Vector3D(coords[idxB], coords[idxB + 1], coords[idxB + 2]);
            Vector3D v_3 = new Vector3D(coords[idxC], coords[idxC + 1], coords[idxC + 2]);
            Vector3D[] vertices = {v_1, v_2, v_3};
            Plane polyPlane = new Plane(v_1, v_2, v_3);
            ArrayList<SubHyperplane<Euclidean2D>> lines = new ArrayList();

            Vector2D[] projPts = new Vector2D[vertices.length];
            for (int ptIdx=0; ptIdx < projPts.length; ptIdx++) {
                projPts[ptIdx] = polyPlane.toSubSpace(vertices[ptIdx]);
            }

            SubLine lineInPlane = null;
            for (int ptIdx=0; ptIdx < projPts.length; ptIdx++) {
                lineInPlane = new SubLine(projPts[ptIdx], projPts[(ptIdx+1)%projPts.length]);
                lines.add(lineInPlane);
            }
            Region<Euclidean2D> polyRegion = new PolygonsSet(lines);
            SubPlane polygon = new SubPlane(polyPlane, polyRegion);
            size = polyRegion.getSize(); // correct size here
            Vector3D[][] verticesTest = getVertices(polygon); // correctly retrieves the BRep for each face
            subHyperplaneList.add(polygon);
        }
        PolyhedronsSet polyhedronsSet = new PolyhedronsSet(subHyperplaneList);
        BSPTree<Euclidean3D> myTree = polyhedronsSet.getTree(true);
        size = polyhedronsSet.getSize();        // strange Inf returned
        size = polyhedronsSet2.getBoundarySize();         // strange Inf returned
        // Member variable and other code for extracting the BRep not included here... can include if desired
        //tree = myTree;
        //Vector3D[][] vertices = getVertices((SubPlane) ((BoundaryAttribute) tree.getAttribute()).getPlusOutside()); // strange values returned here
        System.out.println("END");
    }

    public static void main(String[] args) {
            float[] tetCoords = {1, 0, 0,
                2, 0, 0,
                1, 1, 0,
                1, 0, 1};
            int[] tetIndices = {0, 1, 2,
                0, 1, 3,
                0, 2, 3,
                2, 1, 3};
            BSPMesh blah = new BSPMesh(tetCoords, tetIndices);
     }
}



   

> BSPTree class and recovery of a Euclidean 3D BRep
> -------------------------------------------------
>
>                 Key: MATH-780
>                 URL: https://issues.apache.org/jira/browse/MATH-780
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>         Environment: Linux
>            Reporter: Andrew Willis
>              Labels: BSPTree, euclidean.threed
>         Attachments: BSPMesh2.java
>
>
> New to the work here. Thanks for your efforts on this code.
> I create a BSPTree from a BoundaryRep (Brep) my test Brep is a cube as represented by a float array containing 8 3D points in(x,y,z) order and an array of indices (12 triplets for the 12 faces of the cube). I construct a BSPMesh() as shown in the code below. I can construct the PolyhedronsSet() but have problems extracting the faces from the BSPTree to reconstruct the BRep. The attached code (BSPMesh2.java) shows that a small change to 1 of the vertex positions causes/corrects the problem.
> Any ideas?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (MATH-780) BSPTree class and recovery of a Euclidean 3D BRep

Gary D. Gregory (Jira)
In reply to this post by Gary D. Gregory (Jira)

    [ https://issues.apache.org/jira/browse/MATH-780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13258440#comment-13258440 ]

Luc Maisonobe commented on MATH-780:
------------------------------------

Hi Andrew,

The file BSPMesh2.java you attached to the issue is not sufficient to reproduce the error. It refers to a BSPMesh class and to a PolygonOfPoints class. It seems changing BSPMesh to BSPMesh2 is sufficient to solver the references in the main method (but I am not sure this class is a drop-in replacement for your issue), but I have no clue about the other class. Could you attach it to the issue too ?
               

> BSPTree class and recovery of a Euclidean 3D BRep
> -------------------------------------------------
>
>                 Key: MATH-780
>                 URL: https://issues.apache.org/jira/browse/MATH-780
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>         Environment: Linux
>            Reporter: Andrew Willis
>              Labels: BSPTree, euclidean.threed
>         Attachments: BSPMesh2.java
>
>
> New to the work here. Thanks for your efforts on this code.
> I create a BSPTree from a BoundaryRep (Brep) my test Brep is a cube as represented by a float array containing 8 3D points in(x,y,z) order and an array of indices (12 triplets for the 12 faces of the cube). I construct a BSPMesh() as shown in the code below. I can construct the PolyhedronsSet() but have problems extracting the faces from the BSPTree to reconstruct the BRep. The attached code (BSPMesh2.java) shows that a small change to 1 of the vertex positions causes/corrects the problem.
> Any ideas?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (MATH-780) BSPTree class and recovery of a Euclidean 3D BRep

Gary D. Gregory (Jira)
In reply to this post by Gary D. Gregory (Jira)

     [ https://issues.apache.org/jira/browse/MATH-780?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Willis updated MATH-780:
-------------------------------

    Attachment: BSPMesh2.java

New version. Hopefully no missing references.
               

> BSPTree class and recovery of a Euclidean 3D BRep
> -------------------------------------------------
>
>                 Key: MATH-780
>                 URL: https://issues.apache.org/jira/browse/MATH-780
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>         Environment: Linux
>            Reporter: Andrew Willis
>              Labels: BSPTree, euclidean.threed
>         Attachments: BSPMesh2.java, BSPMesh2.java
>
>
> New to the work here. Thanks for your efforts on this code.
> I create a BSPTree from a BoundaryRep (Brep) my test Brep is a cube as represented by a float array containing 8 3D points in(x,y,z) order and an array of indices (12 triplets for the 12 faces of the cube). I construct a BSPMesh() as shown in the code below. I can construct the PolyhedronsSet() but have problems extracting the faces from the BSPTree to reconstruct the BRep. The attached code (BSPMesh2.java) shows that a small change to 1 of the vertex positions causes/corrects the problem.
> Any ideas?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (MATH-780) BSPTree class and recovery of a Euclidean 3D BRep

Gary D. Gregory (Jira)
In reply to this post by Gary D. Gregory (Jira)

     [ https://issues.apache.org/jira/browse/MATH-780?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Willis updated MATH-780:
-------------------------------

    Attachment: BSPMesh2.java
   

> BSPTree class and recovery of a Euclidean 3D BRep
> -------------------------------------------------
>
>                 Key: MATH-780
>                 URL: https://issues.apache.org/jira/browse/MATH-780
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>         Environment: Linux
>            Reporter: Andrew Willis
>              Labels: BSPTree, euclidean.threed
>         Attachments: BSPMesh2.java, BSPMesh2.java, BSPMesh2.java
>
>
> New to the work here. Thanks for your efforts on this code.
> I create a BSPTree from a BoundaryRep (Brep) my test Brep is a cube as represented by a float array containing 8 3D points in(x,y,z) order and an array of indices (12 triplets for the 12 faces of the cube). I construct a BSPMesh() as shown in the code below. I can construct the PolyhedronsSet() but have problems extracting the faces from the BSPTree to reconstruct the BRep. The attached code (BSPMesh2.java) shows that a small change to 1 of the vertex positions causes/corrects the problem.
> Any ideas?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Issue Comment Edited] (MATH-780) BSPTree class and recovery of a Euclidean 3D BRep

Gary D. Gregory (Jira)
In reply to this post by Gary D. Gregory (Jira)

    [ https://issues.apache.org/jira/browse/MATH-780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13258584#comment-13258584 ]

Andrew Willis edited comment on MATH-780 at 4/20/12 9:01 PM:
-------------------------------------------------------------

New version. Hopefully no missing references. I have removed references to the PolygonOfPoints class and fixed the constructor error. I have created a class specifically for the bug report and apologies for not making it cleaner/more clear.

I'm working on an exact arithmetic version of BSPTrees for CSG operations. I hope to contribute the code if it's of value to the project. Initially i'll use Java's BigDecimal classes for arbitrary arithmetic but I plan on performance enhancements per JR Shewchuk's work (orient3d() etc., http://www.cs.cmu.edu/~quake/robust.html).

hope this code (latest version of BSPMesh2.java) helps.
               
      was (Author: arwillis):
    New version. Hopefully no missing references.
                 

> BSPTree class and recovery of a Euclidean 3D BRep
> -------------------------------------------------
>
>                 Key: MATH-780
>                 URL: https://issues.apache.org/jira/browse/MATH-780
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>         Environment: Linux
>            Reporter: Andrew Willis
>              Labels: BSPTree, euclidean.threed
>         Attachments: BSPMesh2.java, BSPMesh2.java, BSPMesh2.java
>
>
> New to the work here. Thanks for your efforts on this code.
> I create a BSPTree from a BoundaryRep (Brep) my test Brep is a cube as represented by a float array containing 8 3D points in(x,y,z) order and an array of indices (12 triplets for the 12 faces of the cube). I construct a BSPMesh() as shown in the code below. I can construct the PolyhedronsSet() but have problems extracting the faces from the BSPTree to reconstruct the BRep. The attached code (BSPMesh2.java) shows that a small change to 1 of the vertex positions causes/corrects the problem.
> Any ideas?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (MATH-780) BSPTree class and recovery of a Euclidean 3D BRep

Gary D. Gregory (Jira)
In reply to this post by Gary D. Gregory (Jira)

    [ https://issues.apache.org/jira/browse/MATH-780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13259080#comment-13259080 ]

Luc Maisonobe commented on MATH-780:
------------------------------------

Thanks for the new version. I was able to reproduce the problem. However, I don't understand what you are trying to achieve here.

In the double loop that creates the 2D SubLine instances, I have added some print statement to see the indices and the start and end points of the built lines. Here is the output I get:

{noformat}
idxA = 0, idxB = 2, idxC = 4
   adding SubLine: {1; -1} {-1; 1}
   adding SubLine: {-1; 1} {-1; 1}
   adding SubLine: {-1; 1} {1; -1}
idxA = 2, idxB = 4, idxC = 6
   adding SubLine: {-1; 1} {-1; 1}
   adding SubLine: {-1; 1} {-1; -1}
   adding SubLine: {-1; -1} {-1; 1}
idxA = 8, idxB = 14, idxC = 12
   adding SubLine: {1; -1} {-1; 1}
   adding SubLine: {-1; 1} {1; 1}
   adding SubLine: {1; 1} {1; -1}
idxA = 14, idxB = 12, idxC = 10
   adding SubLine: {-1; 1} {1; 1}
   adding SubLine: {1; 1} {-1; -1}
   adding SubLine: {-1; -1} {-1; 1}
idxA = 0, idxB = 8, idxC = 10
   adding SubLine: {1; -1} {1; -1}
   adding SubLine: {1; -1} {-1; -1}
   adding SubLine: {-1; -1} {1; -1}
idxA = 8, idxB = 10, idxC = 2
   adding SubLine: {1; -1} {-1; -1}
   adding SubLine: {-1; -1} {-1; 1}
   adding SubLine: {-1; 1} {1; -1}
idxA = 2, idxB = 10, idxC = 12
   adding SubLine: {-1; 1} {-1; -1}
   adding SubLine: {-1; -1} {1; 1}
   adding SubLine: {1; 1} {-1; 1}
idxA = 10, idxB = 12, idxC = 4
   adding SubLine: {-1; -1} {1; 1}
   adding SubLine: {1; 1} {-1; 1}
   adding SubLine: {-1; 1} {-1; -1}
idxA = 4, idxB = 12, idxC = 14
   adding SubLine: {-1; 1} {1; 1}
   adding SubLine: {1; 1} {-1; 1}
   adding SubLine: {-1; 1} {-1; 1}
idxA = 12, idxB = 14, idxC = 6
   adding SubLine: {1; 1} {-1; 1}
   adding SubLine: {-1; 1} {-1; -1}
   adding SubLine: {-1; -1} {1; 1}
idxA = 8, idxB = 0, idxC = 6
   adding SubLine: {1; -1} {1; -1}
   adding SubLine: {1; -1} {-1; -1}
   adding SubLine: {-1; -1} {1; -1}
idxA = 0, idxB = 6, idxC = 14
   adding SubLine: {1; -1} {-1; -1}
   adding SubLine: {-1; -1} {-1; 1}
   adding SubLine: {-1; 1} {1; -1}
lines.size() = 36
{noformat}

Once the 36 sublines have been created, one polygon is created from them.
It seems for each indices triplets, 3 lines are created representing a semi-infinite stripe. As they are all packed togeteher before building the single polygon, I guess the algorithm gets lots in all redundant boundary lines.

Are you sure the inner loop should build only 3 Subline instance and not 4, and are you sure only one polygon should be built from all these lines ?
               

> BSPTree class and recovery of a Euclidean 3D BRep
> -------------------------------------------------
>
>                 Key: MATH-780
>                 URL: https://issues.apache.org/jira/browse/MATH-780
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>         Environment: Linux
>            Reporter: Andrew Willis
>              Labels: BSPTree, euclidean.threed
>         Attachments: BSPMesh2.java, BSPMesh2.java, BSPMesh2.java
>
>
> New to the work here. Thanks for your efforts on this code.
> I create a BSPTree from a BoundaryRep (Brep) my test Brep is a cube as represented by a float array containing 8 3D points in(x,y,z) order and an array of indices (12 triplets for the 12 faces of the cube). I construct a BSPMesh() as shown in the code below. I can construct the PolyhedronsSet() but have problems extracting the faces from the BSPTree to reconstruct the BRep. The attached code (BSPMesh2.java) shows that a small change to 1 of the vertex positions causes/corrects the problem.
> Any ideas?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (MATH-780) BSPTree class and recovery of a Euclidean 3D BRep

Gary D. Gregory (Jira)
In reply to this post by Gary D. Gregory (Jira)

    [ https://issues.apache.org/jira/browse/MATH-780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13259154#comment-13259154 ]

Andrew Willis commented on MATH-780:
------------------------------------

By the output, the index values displayed are all factors of 2. This seems to indicate you are running the constructor for 2D shapes which is commented out with an if (false) {} statement in the main() function.
I you use the constructor:

public BSPMesh2(float[] coords, int[] indices)

Then your indices should be factors of 3.

If you run the 2D shape constructor on the 3D points (cubeIndices, cubeCoords) strange things will occur as you mention.

I've attached yet another BSPMesh2.java with all extraneous code stripped out.

The code constructs a cube from a set of triangles. Each face (having 4 vertices) is triangulated by adding an edge across the diagonal of the face, i.e., a quad face with vertex indices 0 1 2 3 becomes the following two triplets of indices {0 1 2} {2 1 3} as two triangles.
Hence each face (normally 4 SubLines has 6 subLines (one redundant across the diagonal and these redundant lines have opposing directions (subline 1 2 and subline 2 1)). I am working towards converting generic triangular meshes to BSPTrees (and back to meshes). This is a standard for triangular mesh representations.

I hope this helps clarify.
               

> BSPTree class and recovery of a Euclidean 3D BRep
> -------------------------------------------------
>
>                 Key: MATH-780
>                 URL: https://issues.apache.org/jira/browse/MATH-780
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>         Environment: Linux
>            Reporter: Andrew Willis
>              Labels: BSPTree, euclidean.threed
>         Attachments: BSPMesh2.java, BSPMesh2.java, BSPMesh2.java, BSPMesh2.java
>
>
> New to the work here. Thanks for your efforts on this code.
> I create a BSPTree from a BoundaryRep (Brep) my test Brep is a cube as represented by a float array containing 8 3D points in(x,y,z) order and an array of indices (12 triplets for the 12 faces of the cube). I construct a BSPMesh() as shown in the code below. I can construct the PolyhedronsSet() but have problems extracting the faces from the BSPTree to reconstruct the BRep. The attached code (BSPMesh2.java) shows that a small change to 1 of the vertex positions causes/corrects the problem.
> Any ideas?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (MATH-780) BSPTree class and recovery of a Euclidean 3D BRep

Gary D. Gregory (Jira)
In reply to this post by Gary D. Gregory (Jira)

     [ https://issues.apache.org/jira/browse/MATH-780?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Willis updated MATH-780:
-------------------------------

    Attachment: BSPMesh2.java
   

> BSPTree class and recovery of a Euclidean 3D BRep
> -------------------------------------------------
>
>                 Key: MATH-780
>                 URL: https://issues.apache.org/jira/browse/MATH-780
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>         Environment: Linux
>            Reporter: Andrew Willis
>              Labels: BSPTree, euclidean.threed
>         Attachments: BSPMesh2.java, BSPMesh2.java, BSPMesh2.java, BSPMesh2.java
>
>
> New to the work here. Thanks for your efforts on this code.
> I create a BSPTree from a BoundaryRep (Brep) my test Brep is a cube as represented by a float array containing 8 3D points in(x,y,z) order and an array of indices (12 triplets for the 12 faces of the cube). I construct a BSPMesh() as shown in the code below. I can construct the PolyhedronsSet() but have problems extracting the faces from the BSPTree to reconstruct the BRep. The attached code (BSPMesh2.java) shows that a small change to 1 of the vertex positions causes/corrects the problem.
> Any ideas?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (MATH-780) BSPTree class and recovery of a Euclidean 3D BRep

Gary D. Gregory (Jira)
In reply to this post by Gary D. Gregory (Jira)

     [ https://issues.apache.org/jira/browse/MATH-780?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Willis updated MATH-780:
-------------------------------

    Attachment: BSPMesh2.java
   

> BSPTree class and recovery of a Euclidean 3D BRep
> -------------------------------------------------
>
>                 Key: MATH-780
>                 URL: https://issues.apache.org/jira/browse/MATH-780
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>         Environment: Linux
>            Reporter: Andrew Willis
>              Labels: BSPTree, euclidean.threed
>         Attachments: BSPMesh2.java, BSPMesh2.java, BSPMesh2.java, BSPMesh2.java, BSPMesh2.java
>
>
> New to the work here. Thanks for your efforts on this code.
> I create a BSPTree from a BoundaryRep (Brep) my test Brep is a cube as represented by a float array containing 8 3D points in(x,y,z) order and an array of indices (12 triplets for the 12 faces of the cube). I construct a BSPMesh() as shown in the code below. I can construct the PolyhedronsSet() but have problems extracting the faces from the BSPTree to reconstruct the BRep. The attached code (BSPMesh2.java) shows that a small change to 1 of the vertex positions causes/corrects the problem.
> Any ideas?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (MATH-780) BSPTree class and recovery of a Euclidean 3D BRep

Gary D. Gregory (Jira)
In reply to this post by Gary D. Gregory (Jira)

    [ https://issues.apache.org/jira/browse/MATH-780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13259171#comment-13259171 ]

Andrew Willis commented on MATH-780:
------------------------------------

Sorry, the indices should be {0 1 2} {1 2 3} above and the subline {1 2} will be redundant. I checked the orientation of the planes for the indices above and one of the two triangles is flipped orientation (incorrectly specified indices).
               

> BSPTree class and recovery of a Euclidean 3D BRep
> -------------------------------------------------
>
>                 Key: MATH-780
>                 URL: https://issues.apache.org/jira/browse/MATH-780
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>         Environment: Linux
>            Reporter: Andrew Willis
>              Labels: BSPTree, euclidean.threed
>         Attachments: BSPMesh2.java, BSPMesh2.java, BSPMesh2.java, BSPMesh2.java, BSPMesh2.java
>
>
> New to the work here. Thanks for your efforts on this code.
> I create a BSPTree from a BoundaryRep (Brep) my test Brep is a cube as represented by a float array containing 8 3D points in(x,y,z) order and an array of indices (12 triplets for the 12 faces of the cube). I construct a BSPMesh() as shown in the code below. I can construct the PolyhedronsSet() but have problems extracting the faces from the BSPTree to reconstruct the BRep. The attached code (BSPMesh2.java) shows that a small change to 1 of the vertex positions causes/corrects the problem.
> Any ideas?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (MATH-780) BSPTree class and recovery of a Euclidean 3D BRep

Gary D. Gregory (Jira)
In reply to this post by Gary D. Gregory (Jira)

    [ https://issues.apache.org/jira/browse/MATH-780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13259410#comment-13259410 ]

Luc Maisonobe commented on MATH-780:
------------------------------------

Hi Andrew,

Thanks for the explanation, now I understand your code. It would be a nice enhancement to have this in Apache Commons Math!

I think there are still some indices issues. As far as I understand, for each facet of the cube, the current indices do not define two triangles sharing one diagonal, but rather two triangles with the crossing diagonals (i.e. they overlap on some part of the fact, and a quarter of the facet is missing. If I replace the indices array from:
{noformat}
{0, 1, 2, 1, 2, 3,
 4, 7, 6, 7, 6, 5,
 0, 4, 5, 4, 5, 1,
 1, 5, 6, 5, 6, 2,
 2, 6, 7, 6, 7, 3,
 4, 0, 3, 0, 3, 7}
{noformat}

to
{noformat}
{0, 1, 2, 2, 3, 0,
 4, 7, 6, 6, 5, 4,
 0, 4, 5, 5, 1, 0,
 1, 5, 6, 6, 2, 1,
 2, 6, 7, 7, 3, 2,
 4, 0, 3, 3, 7, 4}
{noformat}

it seems to work (I had no time for thorough testing though). Note the pattern of the change on the last three columns.

Could you tell me if this work for you ang give expected results ?

               

> BSPTree class and recovery of a Euclidean 3D BRep
> -------------------------------------------------
>
>                 Key: MATH-780
>                 URL: https://issues.apache.org/jira/browse/MATH-780
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>         Environment: Linux
>            Reporter: Andrew Willis
>              Labels: BSPTree, euclidean.threed
>         Attachments: BSPMesh2.java, BSPMesh2.java, BSPMesh2.java, BSPMesh2.java, BSPMesh2.java
>
>
> New to the work here. Thanks for your efforts on this code.
> I create a BSPTree from a BoundaryRep (Brep) my test Brep is a cube as represented by a float array containing 8 3D points in(x,y,z) order and an array of indices (12 triplets for the 12 faces of the cube). I construct a BSPMesh() as shown in the code below. I can construct the PolyhedronsSet() but have problems extracting the faces from the BSPTree to reconstruct the BRep. The attached code (BSPMesh2.java) shows that a small change to 1 of the vertex positions causes/corrects the problem.
> Any ideas?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (MATH-780) BSPTree class and recovery of a Euclidean 3D BRep

Gary D. Gregory (Jira)
In reply to this post by Gary D. Gregory (Jira)

    [ https://issues.apache.org/jira/browse/MATH-780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13260152#comment-13260152 ]

Andrew Willis commented on MATH-780:
------------------------------------

The indices you have above work. Thanks.
Try these
{noformat}
            float[] coordVals = {
1.000000f, -1.000000f, -1.000000f,
1.000000f, -1.000000f, 1.000000f,
-1.000000f, -1.000000f, 1.000000f,
-1.000000f, -1.000000f, -1.000000f,
1.000000f, 1.000000f, -1f,
0.999999f, 1.000000f, 1.000000f,
-1.000000f, 1.000000f, 1.000000f,
-1.000000f, 1.000000f, -1.000000f};
int[] coordIdxs = {
0, 1, 2, 0, 2, 3,
4, 7, 6, 4, 6, 5,
0, 4, 5, 0, 5, 1,
1, 5, 6, 1, 6, 2,
2, 6, 7, 2, 7, 3,
4, 0, 3, 4, 3, 7};
{noformat}
Then change the coord 0.999999f to 1.0f as follows:
{noformat}
float[] coordVals = {
1.000000f, -1.000000f, -1.000000f,
1.000000f, -1.000000f, 1.000000f,
-1.000000f, -1.000000f, 1.000000f,
-1.000000f, -1.000000f, -1.000000f,
1.000000f, 1.000000f, -1.000000f,
1.000000f, 1.000000f, 1.000000f,
-1.000000f, 1.000000f, 1.000000f,
-1.000000f, 1.000000f, -1.000000f};
coordIdxs = {
0, 1, 2, 0, 2, 3,
4, 7, 6, 4, 6, 5,
0, 4, 5, 0, 5, 1,
1, 5, 6, 1, 6, 2,
2, 6, 7, 2, 7, 3,
4, 0, 3, 4, 3, 7};
{noformat}

I get an error on the first set of coordinates but not on the second. The indices are the same. This is the original data which gave rise to the bug report.

Let me know what you find.
thanks,
andrew

               

> BSPTree class and recovery of a Euclidean 3D BRep
> -------------------------------------------------
>
>                 Key: MATH-780
>                 URL: https://issues.apache.org/jira/browse/MATH-780
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>         Environment: Linux
>            Reporter: Andrew Willis
>              Labels: BSPTree, euclidean.threed
>         Attachments: BSPMesh2.java, BSPMesh2.java, BSPMesh2.java, BSPMesh2.java, BSPMesh2.java
>
>
> New to the work here. Thanks for your efforts on this code.
> I create a BSPTree from a BoundaryRep (Brep) my test Brep is a cube as represented by a float array containing 8 3D points in(x,y,z) order and an array of indices (12 triplets for the 12 faces of the cube). I construct a BSPMesh() as shown in the code below. I can construct the PolyhedronsSet() but have problems extracting the faces from the BSPTree to reconstruct the BRep. The attached code (BSPMesh2.java) shows that a small change to 1 of the vertex positions causes/corrects the problem.
> Any ideas?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (MATH-780) BSPTree class and recovery of a Euclidean 3D BRep

Gary D. Gregory (Jira)
In reply to this post by Gary D. Gregory (Jira)

    [ https://issues.apache.org/jira/browse/MATH-780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13264594#comment-13264594 ]

Luc Maisonobe commented on MATH-780:
------------------------------------

I have made some progress analyzing this issue.
First, I confirm there is a problem in the code.
It appears that during the build, a very thin triangle occurs on a facet. In the facet plane, the coordinates of the three vertices of this triangle are (0.9999999997583233 -0.999998986721039), (-1.0000000000000002 -0.9999989867210387) and (-1.0000000000000002 -1.0). While extracting the vertices of this triangle, the public getVertices method in PolygonsSet first build the segments and then calls the private followLoop method to identify their topology (i.e. how they connect to each other). The segments are properly built and identified, but the followLoop method fails to connect them. It hits a dedicated conditional statement considering the loop is below some predefined threshold (despite it really is above this threshold) and it ignores the triangle completely. Later, this breaks things as a node in the tree without a boundary must be a leaf node which must contain a boolean attribute. However, here we are not a a leaf node, we are at an internal node with an ignored boundary.

So I think there are two bugs here. One bug for not identifying correctly the triangle, and one bug for misclassifying an internal node as a leaf node.

The triangle identification bug will probably take some time to fix. The internal/leaf node bug will probably be easy to fix.

I'll look into that, hopefully in the next few days.

               

> BSPTree class and recovery of a Euclidean 3D BRep
> -------------------------------------------------
>
>                 Key: MATH-780
>                 URL: https://issues.apache.org/jira/browse/MATH-780
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>         Environment: Linux
>            Reporter: Andrew Willis
>              Labels: BSPTree, euclidean.threed
>         Attachments: BSPMesh2.java, BSPMesh2.java, BSPMesh2.java, BSPMesh2.java, BSPMesh2.java
>
>
> New to the work here. Thanks for your efforts on this code.
> I create a BSPTree from a BoundaryRep (Brep) my test Brep is a cube as represented by a float array containing 8 3D points in(x,y,z) order and an array of indices (12 triplets for the 12 faces of the cube). I construct a BSPMesh() as shown in the code below. I can construct the PolyhedronsSet() but have problems extracting the faces from the BSPTree to reconstruct the BRep. The attached code (BSPMesh2.java) shows that a small change to 1 of the vertex positions causes/corrects the problem.
> Any ideas?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (MATH-780) BSPTree class and recovery of a Euclidean 3D BRep

Gary D. Gregory (Jira)
In reply to this post by Gary D. Gregory (Jira)

    [ https://issues.apache.org/jira/browse/MATH-780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13267481#comment-13267481 ]

Andrew Willis commented on MATH-780:
------------------------------------

Thanks for your input. I am still very much interested in resolving this. I'll keep an eye out for your reply.
               

> BSPTree class and recovery of a Euclidean 3D BRep
> -------------------------------------------------
>
>                 Key: MATH-780
>                 URL: https://issues.apache.org/jira/browse/MATH-780
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>         Environment: Linux
>            Reporter: Andrew Willis
>              Labels: BSPTree, euclidean.threed
>         Attachments: BSPMesh2.java, BSPMesh2.java, BSPMesh2.java, BSPMesh2.java, BSPMesh2.java
>
>
> New to the work here. Thanks for your efforts on this code.
> I create a BSPTree from a BoundaryRep (Brep) my test Brep is a cube as represented by a float array containing 8 3D points in(x,y,z) order and an array of indices (12 triplets for the 12 faces of the cube). I construct a BSPMesh() as shown in the code below. I can construct the PolyhedronsSet() but have problems extracting the faces from the BSPTree to reconstruct the BRep. The attached code (BSPMesh2.java) shows that a small change to 1 of the vertex positions causes/corrects the problem.
> Any ideas?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Resolved] (MATH-780) BSPTree class and recovery of a Euclidean 3D BRep

Gary D. Gregory (Jira)
In reply to this post by Gary D. Gregory (Jira)

     [ https://issues.apache.org/jira/browse/MATH-780?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Luc Maisonobe resolved MATH-780.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 3.1

Fixed in subversion repository as of r1337929.

The fix is an ugly one. I have only prevented the wrong cast since boolean attributes occur only at leaf nodes in the tree (internal nodes have different attributes, related to the boundary).

The roots of the problem are much deeper than that, and need more thoughts.
               

> BSPTree class and recovery of a Euclidean 3D BRep
> -------------------------------------------------
>
>                 Key: MATH-780
>                 URL: https://issues.apache.org/jira/browse/MATH-780
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>         Environment: Linux
>            Reporter: Andrew Willis
>              Labels: BSPTree, euclidean.threed
>             Fix For: 3.1
>
>         Attachments: BSPMesh2.java, BSPMesh2.java, BSPMesh2.java, BSPMesh2.java, BSPMesh2.java
>
>
> New to the work here. Thanks for your efforts on this code.
> I create a BSPTree from a BoundaryRep (Brep) my test Brep is a cube as represented by a float array containing 8 3D points in(x,y,z) order and an array of indices (12 triplets for the 12 faces of the cube). I construct a BSPMesh() as shown in the code below. I can construct the PolyhedronsSet() but have problems extracting the faces from the BSPTree to reconstruct the BRep. The attached code (BSPMesh2.java) shows that a small change to 1 of the vertex positions causes/corrects the problem.
> Any ideas?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira