>
> On 12/15/09 10:21 PM, Mark Swindell wrote:
>> 40,116
>> 98,186
>> 132,118
>>
>> How would one determine the angle created from three points, such as those
>> above?
Hi Mark,
I'm using the following handlers. SurfaceTriangle is used to determine if you
compute the outer (>180) or inner angle with summit c in calcangle.
HTH
Jacques
function SurfaceTriangle a,c,b
----------------------------------------------------------
-- a,c,b: points
-- returns twice the surface of triangle a,c,b
-- the result is signed, positive if points follow each other clockwise,
-- negative otherwise.
-- aligned points return zero.
----------------------------------------------------------
put ((item 1 of c - item 1 of a)*(item 2 of b - item 2 of a)\
- (item 1 of b - item 1 of a)*(item 2 of c - item 2 of a)) into aire
return aire
end SurfaceTriangle
function calcAngle a,c,b
----------------------------------------------------------
-- a,c,b : points.
-- returns angle between ca and cb in degrees
----------------------------------------------------------
put Distance(c,b) into da
put Distance(a,c) into db
put Distance(a,b) into dc
put (da + db + dc)/2 into p
put sqrt(p*(p-dc)/(db*da)) into lecos
if lecos > 1 then put 1 into lecos
if lecos < -1 then put -1 into lecos
put acos(lecos) * 180 / pi into alpha
put 2 * alpha into alpha
if SurfaceTriangle(a,c,b) then
return alpha
else
return 360-alpha
end if
end calcAngle
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution