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

gün alppay commented on MATH-1162:
----------------------------------

hi Luc,

thanks for looking into this. I'm going to mention another issue that I'm 
seeing that might be related since you mentioned BSPTree. here it is.... the 
following throws a different exception:

{noformat}
import org.apache.commons.math3.geometry.euclidean.twod.PolygonsSet;
import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;

class Test {
    public static void main(String[] args) {
                new PolygonsSet(1.0E-10,
                                            new Vector2D(-76.8095991248, 
-15.087601999),
                                            new Vector2D(-76.8095991245, 
-18.288001999), 
                                            new Vector2D(-10.0583778834, 
-18.2880019979), 
                                            new Vector2D(-10.0583778835, 
-15.0876019979),
                                            new Vector2D(-54.8639991264, 
-15.0876019984));

    }
}
{noformat}

the exception I get is
{noformat}
Exception in thread "main" java.lang.NullPointerException
        at 
org.apache.commons.math3.geometry.partitioning.BSPTree.fitToCell(BSPTree.java:301)
        at 
org.apache.commons.math3.geometry.partitioning.BSPTree.insertCut(BSPTree.java:159)
        at 
org.apache.commons.math3.geometry.euclidean.twod.PolygonsSet.insertEdges(PolygonsSet.java:333)
        at 
org.apache.commons.math3.geometry.euclidean.twod.PolygonsSet.insertEdges(PolygonsSet.java:406)
        at 
org.apache.commons.math3.geometry.euclidean.twod.PolygonsSet.insertEdges(PolygonsSet.java:406)
        at 
org.apache.commons.math3.geometry.euclidean.twod.PolygonsSet.insertEdges(PolygonsSet.java:406)
        at 
org.apache.commons.math3.geometry.euclidean.twod.PolygonsSet.insertEdges(PolygonsSet.java:406)
        at 
org.apache.commons.math3.geometry.euclidean.twod.PolygonsSet.verticesToTree(PolygonsSet.java:309)
        at 
org.apache.commons.math3.geometry.euclidean.twod.PolygonsSet.<init>(PolygonsSet.java:156)
        at Test.main(test.java:6)
{noformat}



> contains(Region<S> region) method of AbstractRegion throws 
> NullPointerException exception 
> ------------------------------------------------------------------------------------------
>
>                 Key: MATH-1162
>                 URL: https://issues.apache.org/jira/browse/MATH-1162
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.3
>         Environment: tested on windows 8 and heroku
>            Reporter: gün alppay
>
> the contains call on 
> org.apache.commons.math3.geometry.partitioning.AbstractRegion throws an 
> exception in the sample below:
> {noformat}
> import org.apache.commons.math3.geometry.partitioning.Region;
> import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
> import org.apache.commons.math3.geometry.euclidean.twod.Euclidean2D;
> import org.apache.commons.math3.geometry.euclidean.twod.PolygonsSet;
> class Test {
>     public static void main(String[] args) {
>       Region<Euclidean2D> p = new PolygonsSet( 1.0e-10, new 
> Vector2D(4.267199999996532, -11.928637756014894),
>                                                         new 
> Vector2D(4.267200000026445, -14.12360595809307), 
>                                                         new 
> Vector2D(9.144000000273694, -14.12360595809307), 
>                                                         new 
> Vector2D(9.144000000233383, -11.928637756020067));
>       Region<Euclidean2D> w = new PolygonsSet( 1.0e-10,  new 
> Vector2D(2.56735636510452512E-9, -11.933116461089332),
>                                                          new 
> Vector2D(2.56735636510452512E-9, -12.393225665247766), 
>                                                          new 
> Vector2D(2.56735636510452512E-9, -27.785625665247778), 
>                                                          new 
> Vector2D(4.267200000030211, -27.785625665247778), 
>                                                          new 
> Vector2D(4.267200000030211, -11.933116461089332));
>       p.contains(w);
>     }
> }
> {noformat}
> the exception thrown is:
> {noformat}
> Exception in thread "main" java.lang.NullPointerException
>         at 
> org.apache.commons.math3.geometry.partitioning.AbstractRegion.isEmpty(AbstractRegion.java:263)
>         at 
> org.apache.commons.math3.geometry.partitioning.AbstractRegion.isEmpty(AbstractRegion.java:267)
>         at 
> org.apache.commons.math3.geometry.partitioning.AbstractRegion.isEmpty(AbstractRegion.java:267)
>         at 
> org.apache.commons.math3.geometry.partitioning.AbstractRegion.isEmpty(AbstractRegion.java:267)
>         at 
> org.apache.commons.math3.geometry.partitioning.AbstractRegion.isEmpty(AbstractRegion.java:267)
>         at 
> org.apache.commons.math3.geometry.partitioning.AbstractRegion.isEmpty(AbstractRegion.java:267)
>         at 
> org.apache.commons.math3.geometry.partitioning.AbstractRegion.isEmpty(AbstractRegion.java:267)
>         at 
> org.apache.commons.math3.geometry.partitioning.AbstractRegion.isEmpty(AbstractRegion.java:251)
>         at 
> org.apache.commons.math3.geometry.partitioning.AbstractRegion.contains(AbstractRegion.java:295)
>         at Test.main(test.java:19)
> {noformat} 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to