[postgis-devel] What's the point of this exercise in intersects?

Obe, Regina robe.dnd at cityofboston.gov
Mon Sep 8 12:14:28 PDT 2008


I was looking at the lwgeom_geos_c.c intersects function - starting at line 2039 and was thinking isnt' this
a bit redundant.  By the time we get into this function we have already done a bounding box check.  It probably isn't adding much overhead, but thought I would flag it as potentially redundant.
 
 /*
  * short-circuit 1: if geom2 bounding box does not overlap
  * geom1 bounding box we can prematurely return FALSE.
  * Do the test IFF BOUNDING BOX AVAILABLE.
  */
 if ( getbox2d_p(SERIALIZED_FORM(geom1), &box1) &&
  getbox2d_p(SERIALIZED_FORM(geom2), &box2) )
 {
  if ( box2.xmax < box1.xmin ) PG_RETURN_BOOL(FALSE);
  if ( box2.xmin > box1.xmax ) PG_RETURN_BOOL(FALSE);
  if ( box2.ymax < box1.ymin ) PG_RETURN_BOOL(FALSE);
  if ( box2.ymin > box2.ymax ) PG_RETURN_BOOL(FALSE);
 }
 
 
thanks,
Regina
 


-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20080908/4f1b24e2/attachment.html>


More information about the postgis-devel mailing list