views:

27

answers:

1

Hi all,

Im trying to achieve something similar to the flash movie in the below link. http://mathopenref.com/coordtrianglearea.html

As we drag the points of the triangle, the coordinates labels, ( A(1,2)) are properly aligned and arrange themselves so that they never collide with each other and never falls inside the triangle.

Please guide me..

Thanks in advance.

A: 

in the example you gave, the textfield seems to be aligned outside the triangle on the angle bisection of the corresponding corner.

for the position in one corner, take the two vectors to the other corners. normalize them and then add them and normalize the resulting vector again. this gives you the vector v of the angle bisection in that corner. multiply the vector with a negative constant and add it to the corner, and you'll obtain a position p outside the triangle. finally, if the angle of v is between pi/2 and -pi/2 (pointing right) align the right border of the label to p, and the left border otherwise.

for simple vector calculations, please see flash.geom.Point.

greetz
back2dos

back2dos
Thanks dude, I will try it out now and let U know. Thank U once again.
Arafat
I tried your solution and it works great!Thanks a million for saving my day!By the way, I like ur nick, "back2dos".
Arafat