Algorithm Engineering and Experimentation

Volume 1619 of the series Lecture Notes in Computer Science pp 114-128


Practical Point-in-Polygon Tests Using CSG Representations of Polygons

  • Robert J. WalkerAffiliated withUBC Dept. of Computer Science
  • , Jack SnoeyinkAffiliated withUBC Dept. of Computer Science

* Final gross prices may vary according to local VAT.

Get Access


We investigate the use of a constructive solid geometry (CSG) representation in testing if a query point falls inside a polygon; in particular, we use a CSG tree whose leaves correspond to halfplanes defined by edges and whose internal nodes are intersections or unions of the regions defined by their subtrees. By preprocessing polygons into this representation, we obtain a linear-space data structure for point-in-polygon tests that has a tight inner loop that can prune unnecessary edge tests during evaluation. We experiment with opportunities to optimize the pruning by permuting children of nodes. The resulting test is less memory-intensive than grid methods and faster than existing one-shot methods. It also extends to ray-shooting in 3-space.