|
-
Jul 19th, 2000, 09:44 PM
#19
Hyperactive Member
A Solution in Code
Paul282,
I was intrigued by the discussion and with a couple of hours to kill I decided to put my mind to the task. Well, a day later (ummm did I mention I forgot most of my trig), I have a solution which seems fast to me. It is totally VB with no API and it is fast enough to catch me moving into the polygon and out again as long as the shape is at least 20 pixels wide or so. If it is smaller, then I have to move the mouse slightly slower, otherwise I can moe as fast as I like.
The test bed I wrote is not fantastic, but if you are looking for ideas, you are welcome to it. I think it is too much to post here though (25k in text format).
I have no algorithims book that has been referred to however I imagine that the solution I implement is covered in such a book and no doubt done much better than I did it. It amounts to an offshoot of the previously discussed idea of tracing a line through the shape only it's optimised for polygons (straight sides).
Also, I do not know how reliable it is for a polygon that intersects with itself (sounds painful) but I don't think you were trying to do that anyhow.
Let me know if you're interested.
Cheers
Paul Lewis
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
|