[ 
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 via email to