[postgis-users] Problem finding intersection of LineString and BOX3D?

Mark Cave-Ayland mark.cave-ayland at webbased.co.uk
Fri Aug 16 05:44:11 PDT 2002


> The problem with the code is probably in the function
> lineseg_inside_box().
>
> You should be able to find lots of references to the cohen-sutherland
> algorithm online (or in any graphics textbook), and your simple test
> case should find out whats wrong very quickly!!
>
> dave

Hi Dave,

I copied out my test case into a separate C program and managed to find the
error in the truly_inside() function - you were right about the
lineseg_inside_box() function. The problem I was having was with shallow
horizontal lines and it was because the C-S algorithm only checks for
intersections with the horizontal lines of the box. I modified the algorithm
to include the vertical edges and now it works great every time :)

Many thanks for your support on this one, PostGIS is a great piece of
software and will only get better with technical support like this :) Please
find enclosed the resulting patch against PostGIS 0.7.1 attached to this
email for submission for the next release of PostGIS.


Cheers,

Mark.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: postgis-trulyinside.patch
Type: application/octet-stream
Size: 1264 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20020816/5b003d93/attachment.obj>


More information about the postgis-users mailing list