A more precise polygon_overlap()

From: "Kenneth Chan" <kkchan(at)technologist(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: A more precise polygon_overlap()
Date: 2002-05-22 19:23:35
Message-ID: 20020522192335.50500.qmail@iname.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Gents,

I am looking for a more precise polygon overlap test and any comment/pointers/suggestions are appreciated. Attached is the modified poly_overlap in geoops.c.

If the polygons pass the bounding box check, the following tests will be carried out. The tests are terminated as soon as one of them returns true:

1) At least one of the vertex in polygon a is inside polygon b
2) At least one of the vertex in polygon b is inside polygon a
3) At least one edge of polygon a intersects with an edge on polygon b

All these tests could be expensive for polygons with lots of vertices. Would anyone know where I can find information on a more efficient way of determining polygon overlap.

Efficiency aside, is there anything obivious I have missed which could lead to an incorrect result?

The end game for me is to be able to test if a path enters a polygon and this is a first step as I am new to postgresql. Looks like postgresql converts the path to a polygon and call poly_overlap(), which could lead to incorrect result. At some stage, I might add an overlap operator that accepts a path and a polygon.

TIA
Kenneth Chan.
--
_______________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup

Attachment Content-Type Size
geo_ops.c.change application/octet-stream 2.0 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Manfred Koizar 2002-05-22 20:00:30 Re: Killing dead index tuples before they get vacuumed
Previous Message Neil Conway 2002-05-22 19:11:56 ksqo?