[geos-devel] GEOS SVN Geometry::contains bug!?

Martin Davis mbdavis at refractions.net
Mon Jul 23 20:22:08 EDT 2007


Good catch.  I confirm that those lines do not appear in JTS, and should 
be removed.

Oliver Baltzer wrote:
> The contains relation is not commutative hence in source/geom/Geometry.cpp
> lines 425-427 should be removed.
>
> See:
>
> bool
> Geometry::contains(const Geometry *g) const
> {
> #ifdef SHORTCIRCUIT_PREDICATES
>         // short-circuit test
>         if (! getEnvelopeInternal()->contains(g->getEnvelopeInternal()))
>                 return false;
> #endif
>
>         // optimization for rectangle arguments
>         if (isRectangle()) {
>                 return predicate::RectangleContains::contains((Polygon&)*this, *g);
>         }
> /*
>  *       if (g->isRectangle()) {
>  *               return predicate::RectangleContains::contains((const Polygon&)*g, *this);
>  *       }
>  */
>         IntersectionMatrix *im=relate(g);
>         bool res=im->isContains();
>         delete im;
>         return res;
> }
>
> Cheers,
> Oliver
>
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> geos-devel mailing list
> geos-devel at geos.refractions.net
> http://geos.refractions.net/mailman/listinfo/geos-devel
>   

-- 
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022




More information about the geos-devel mailing list