Function Newbie question...
Malte Brill
malte.brill at t-online.de
Fri Dec 6 05:24:00 EST 2002
Hi list,
I wrote a small function that returns the distance between two Points.
Function getDistance x1,y1,x2,y2
put sqrt((X1 - X2) ^ 2 + (Y1 - Y2) ^ 2) into theDistance
return theDistance
end getDistance
It works for me if I pass the values to it on a mouseUp event.
on mouseUp
put item 1 of the loc of graphic "kreis1" into x1
put item 1 of the loc of graphic "kreis2" into x2
put item 2 of the loc of graphic "kreis1" into y1
put item 2 of the loc of graphic "kreis2" into y2
put getDistance (x1,y1,x2,y2)
end mouseUp
O.K., but if I have more than two objects (lets say about 5). how could I
check the distances between all of them efficiantly?
1->2 2->1
1->3 2->3
1->4 2->4
1->5 2->5 ... 5->4
Using a repeat structure seams not being a good idea to me. So here I am
stuck, as the number of objects I want to check might vary from time to
time.
Any Ideas?
Regards,
Malte
More information about the use-livecode
mailing list