Hi all,
I'm looking for a mathematic way to check if a point resides within a rectangle.
The rectangle is not parallel to the axes, instead its rotating all the time.
It's not a movieclip so hitTest is out of the question.
Any suggestions how I could solve this problem ?
cheers,
olli
Check whteher your point is iniside boundries by something like this:
if(point.x rect.minX point.x rect.maxX point.y rect.minY
point.Y rect.maxY)
guess something like that should work.
2006/12/21, Oliver Müller [EMAIL PROTECTED]:
Hi all,
I'm looking for a mathematic way to check if a
Skinner's work here is bitmap-based and is quite efficient:
http://www.gskinner.com/blog/archives/2005/08/flash_8_shape_b.html
This method would require you to attach at least a 1-pixel clip to use for
your point, but is way simple compared to the math involved, i'm sure.
-Scott
On 12/21/06,
The rectangle is not parallel to the axes, instead its rotating all the
time.
I don't believe that using the bounds of a clip will account for any
rotations.-Scott
-Scott
On 12/21/06, Janis Radins [EMAIL PROTECTED] wrote:
Check whteher your point is iniside boundries by something like
Hey Olli,
One way to do it without using movieclips is to create an off screen
buffer image the size of the stage and draw your rectangle to it at the
proper location.
If you clear the buffer black and draw a white rectangle to it, you can
then test the coord to see if it's not black.
For an arbitrary rectangle you'll have to do some math. Of the top of
my head, here's a way to do it:
First you'll need to be familiar with vector math, including dot products:
http://mathworld.wolfram.com/DotProduct.html
So, pick an arbitrary point on the rectangle and get the vectors for
the
thanks a lot - I will test your solutions later on.
-olli
2006/12/21, Andy Herrman [EMAIL PROTECTED]:
For an arbitrary rectangle you'll have to do some math. Of the top of
my head, here's a way to do it:
First you'll need to be familiar with vector math, including dot products:
7 matches
Mail list logo