2D Point Within a 2D Triangle
I just thought some of you might like a function that determines if a 2D point exists within a 2D triangle.
In this case, I have restricted the dragging of an MC to within the bounds of a triangle using this function.
My next move is to constrain dragging to the outermost edges of a triangle, square, pentagon, etc...
Anyone able to contribute?
Attached Files
Is this, what you are searching for ?
http://trashcan.andre-michelle.com/f.../constrain.zip
try the 'com' version. for convex polygons only.
Last edited by AndreMichelle; 04-10-2006 at 08:56 AM .
Sweeettt. I've searched for this far and wide. thank you!
You are either way above the average intellegence or you have a hekc of a lot of time on your hands....wow!
Last edited by Sleeve; 04-10-2006 at 12:56 PM .
here is a small bugfix - did you find it ?
http://trashcan.andre-michelle.com/f...olygon.com.swf
http://trashcan.andre-michelle.com/f...olygon.com.fla
no big deal here. I thought about this solution, while thinking about the distance from a point to a polygon. It's the same technic.
yes, this is no big deal but the other examples on your websites are great. Good work.
One suggestion if I may.
Use this.onMouseMove and add a updateAfterEvent() at the end of your function to make it frame rate independent. As you may know, it's a smoother motion at any framerate.
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