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

Matt Juntunen commented on GEOMETRY-59:
---------------------------------------

I took a look at this and the code is indeed not constructing the tree as 
expected. It does the same thing in my working branch as well (although that's 
not saying a whole lot since the threed package is still very much a work in 
progress). The issue is that both the new and old versions of the code 
construct the plane that the facet lies in by taking the first three vertices 
from the facet. In the case where the facet is convex, the facet plane has the 
orientation you would expect However, in the case described here for the facet 
with vertex indices 4, 5, 6, 7, the first three vertices have a 
counter-clockwise orientation and so the computed plane normal points down the 
-z axis instead of up the +z axis. This makes the point (2, 1, 3) actually lie 
inside of the region. (The region is also infinite in size.)

I'm not sure of a good approach to this quite yet. When the facet is concave 
there isn't a definite "correct" orientation for the underlying plane. One 
option would be to restrict the construction method to throw in cases like 
this, just so that unexpected regions aren't returned.

Also, as [~erans] mentioned, any feedback or help with the refactoring is much 
appreciated, especially from people who are familiar with or have used the old 
code. There is a draft pull request 
[here|https://github.com/apache/commons-geometry/pull/34] and my working branch 
is 
[here|https://github.com/darkma773r/commons-geometry/tree/geometry-32-working].

> unexpected output from PolyhedronsSet::checkPoint
> -------------------------------------------------
>
>                 Key: GEOMETRY-59
>                 URL: https://issues.apache.org/jira/browse/GEOMETRY-59
>             Project: Apache Commons Geometry
>          Issue Type: Bug
>          Components: Euclidean 3D
>            Reporter: Dirk Bonekämper
>            Priority: Major
>         Attachments: InsideProblemTest.java
>
>
> In my project I'm working with 3D Regions modeled as prisms. The base 
> polygons are mostly concave. I got wrong results and boiled it down to the 
> attached unit test. It creates a prism with a concave base. A point that is 
> above the prism gets classified as INSIDE.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to