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

Oliver Baltzer obaltzer at cs.dal.ca
Mon Jul 23 20:07:29 EDT 2007


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

-- 
Oliver Baltzer
Faculty of Computer Science  
Dalhousie University
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.osgeo.org/pipermail/geos-devel/attachments/20070723/7164af9e/attachment.bin


More information about the geos-devel mailing list