|
-
Jul 17th, 2000, 08:31 AM
#7
Thread Starter
Fanatic Member
Originally posted by billrogers
There is a geometric algorithm out there that handles this issue, I have it but dont have my algorithms book with me.
I used it with a c++ project and it worked quite nicely.
If I remember right it figured it out by counting the times lines of the polygron were crossed, if it was an odd number then you know the point click is inside the polygon, even number, the click was outside the polygon.
Code:
_
/ \
|.| So this would have one times of crossing the line
\_/
_
/ \
| | . This would have even.
\_/
I will try to remember to look it up at home.
I get it Bill!!
check the x pos of the point for crosses then the Y, you'd need to know the the values of the polygon at a specific axis though, but that'd be faster than breaking up to trinagles... I'll see if I can come up with some code
Paul Dwyer 
Network Engineer
Aussie In Tokyo
Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|