Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B1E889A57 for ; Fri, 20 Apr 2012 16:43:02 +0000 (UTC) Received: (qmail 49951 invoked by uid 500); 20 Apr 2012 16:43:02 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 49853 invoked by uid 500); 20 Apr 2012 16:43:02 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 49767 invoked by uid 99); 20 Apr 2012 16:43:02 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Apr 2012 16:43:02 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Apr 2012 16:43:00 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id B699048C18A for ; Fri, 20 Apr 2012 16:42:40 +0000 (UTC) Date: Fri, 20 Apr 2012 16:42:40 +0000 (UTC) From: "Andrew Willis (Updated) (JIRA)" To: issues@commons.apache.org Message-ID: <1282261550.10273.1334940160749.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <705601270.10034.1334934760655.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Updated] (MATH-780) BSPTree class and recovery of a Euclidean 3D BRep MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ 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.(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> 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> 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 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 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