Hi Ryanm,
Here is a function which I wrote a long time back. It calculates included
angle.... it uses cosine rule to calculate the angle.
The other function calculates shortest distance between two points.
function getAngle(vertex1,vertex2,vertex3){
var a = (measureLength(vertex2,vertex3));
var b = (measureLength(vertex3,vertex1));
var c = (measureLength(vertex1,vertex2));
var abc1 = (((a*a)+(c*c)-(b*b)) / (2*a*c));
var angle =(Math.round(Math.acos(abc1)*(180/Math.PI)));
return(angle);
}
function measureLength (obj1, obj2) {
var diffx = (obj2._x-obj1._x);
var diffy = (obj2._y-obj1._y);
return (Math.sqrt((diffx*diffx)+(diffy*diffy)));
}
Regards,
Rahul
----- Original Message -----
From: "ryanm" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <[email protected]>
Sent: Tuesday, November 22, 2005 4:30 PM
Subject: Re: [Flashcoders] How to solve SSS triangle?
> >I am having 3 movie Clips named point1_mc, point2_mc, point3_mc in the
> > stage. They are arranged in such a way to form a triangle...
> > Now how can i get those 3 angles and sides formed by these points.?
> >
> With a high school geometry textbook? ;-)
>
> Law of cosines: c^2 = a^2 + b^2 - 2ab*Cos(q)
> Where a, b, and c are the sides, and q is the angle opposite c
>
> ryanm
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders