Archived

This topic is now archived and is closed to further replies.

distance between edge and point

This topic is 5143 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Guest Anonymous Poster
Probably float precision. You need to use some small number (1e-6 is good) to make the edges thick. You can''t treat them as infinitely thin.

Plenty of algorithms for this all over in books and stuff have a look for triangles. For general poly''s it is a lot more work.

Share this post


Link to post
Share on other sites
thank u for u answer anonymous P. I don''t understand why my methods failled. I try to look at 2 vectors , one with the edge and the second with the point and a point of the edge, if this two vectors are co-linear ... but it don''t worked

Share this post


Link to post
Share on other sites
ok well... best thing to do is find the closest distance between the point and the line and then if that distance is lower than a certain tolerance, you can assume that the point lies on the line...

Here''s how:

http://astronomy.swin.edu.au/~pbourke/geometry/pointline/

If you wanna know if the point is inside the polygon then you can use solution 4 from here:

http://astronomy.swin.edu.au/~pbourke/geometry/insidepoly/

whenever your doing calculations like this, you always need a tolerance, you can''t assume the computer is gonna store your numbers perfectly and calculate everything 100% accurately.

Share this post


Link to post
Share on other sites