#!/bin/sh # MetaCard 2.4 stack # The following is not ASCII text, # so now would be a good time to q out of more exec mc $0 "$@" Follow the bouncing ball function perpDist tP,tLine put item 1 of tLine into x2 put item 2 of tLine into y2 put item 3 of tLine into x3 put item 4 of tLine into y3 put item 1 of tP into x1 put item 2 of tP into y1 if x3-x2 is 0 then return abs(x1-x2) else put (y3-y2)/(x3-x2) into m -- The slope return abs(m*(x1-x2)-(y1-Y2))/sqrt(1+m*m) end if end perpDist on openstack choose the browse tool end openstack on preOpenStack choose the browse tool end preOpenStack t U Lucida Grande U W U 9 U Times New Roman W Times New Roman $ W Times New Roman W 9 W 9 U 9 W 9 W Lucida Grande cREVGeometryCache stackID 6555 cREVGeneral scriptChecksum 9kmP8 debugObjects ?button id 1005 of card id 1002 of stack "Rubber Ball" graphic id 1003 of card id 1002 of stack "Elastic ball" graphic id 5743 of card id 5738 of stack "Rubber ball" graphic id 1003 of card id 1002 of stack "Rubber ball" button id 5748 of card id 5738 of stack "Rubber ball" graphic id 5732 of card id 5738 of stack "Rubber ball" graphic id 5732 of card id 5738 of stack "myLine" graphic id 5815 of card id 5827 of stack "Rubber ball" graphic id 5815 of card id 5827 of stack "Graphic 1" graphic id 5815 of card id 5827 of stack "Bouncing ball" graphic id 5850 of card id 5863 of stack "Bouncing ball" graphic id 5815 of card id 5827 of stack "Graphic tools" graphic id 5884 of card id 5897 of stack "Graphic tools" graphic id 5917 of card id 5929 of stack "Graphic tools" graphic id 5917 of card id 5929 of stack "card id 5929" graphic id 5732 of card id 5738 of stack "card id 5929" graphic id 6045 of card id 6047 of stack "Follow the bouncing ball" graphic id 5884 of card id 5897 of stack "Follow the bouncing ball" graphic id 6200 of card id 6202 of stack "Follow the bouncing ball" bookmarks handlerList perpDist openstack preOpenStacktempScript prevHandler perpDistscriptSelection char 477 to 476script )
function perpDist tP,tLine
put item 1 of tLine into x2
put item 2 of tLine into y2
put item 3 of tLine into x3
put item 4 of tLine into y3
put item 1 of tP into x1
put item 2 of tP into y1
if x3-x2 is 0 then
return abs(x1-x2)
else
put (y3-y2)/(x3-x2) into m -- The slope
return abs(m*(x1-x2)-(y1-Y2))/sqrt(1+m*m)
end if
end perpDist
on openstack
choose the browse tool
end openstack
on preOpenStack
choose the browse tool
end preOpenStack
P cREVGeometryCacheIDs 1108343705619 57301108342523075 57281108424165944 57471108424150711 57461109349981985 61771108342633221 57291108340866467 57271108343966445 57311107870321097 1003 cREVGeometrycache total 9order cREVGeneral scriptChecksum h)ژ@ح\@ bookmarks breakPoints handlerList scriptSelection char 1 to 0prevHandler perpDisttempScript script _ ` a b c r s ! j Pmfunction thePolyLines tPolyPoints repeat with i = 1 to the number of lines in tPolyPoints put line i of tPolyPoints & comma & line i+1 of tPolyPoints & return after results end repeat delete last line of results return results end thePolyLines function perpDist tP,tLine put item 1 of tLine into x2 put item 2 of tLine into y2 put item 3 of tLine into x3 put item 4 of tLine into y3 put item 1 of tP into x1 put item 2 of tP into y1 if x3-x2 is 0 then return (x1-x2) else put (y3-y2)/(x3-x2) into m -- The slope return (m*(x1-x2)-(y1-Y2))/sqrt(1+m*m) end if end perpDist cREVGeometryCacheIDs 1108343705619 57361108395006710 57441108511492272 58031108342633221 57351109350108503 61781108343966445 57371108506874770 57681108498536155 57551108498536156 57561108342523075 57341108498307386 57541108430058696 57481108340866467 57331107870321097 5732 cREVGeometryCache total 14order cREVGeneral scriptChecksum *ˎ$)R饍 bookmarks handlerList thePolyLines perpDistbreakPoints tempScript prevHandler thePolyLinesscriptSelection char 1 to 256scriptfunction thePolyLines tPolyPoints
repeat with i = 1 to the number of lines in tPolyPoints
put line i of tPolyPoints & comma & line i+1 of tPolyPoints & return after results
end repeat
delete last line of results
return results
end thePolyLines
function perpDist tP,tLine
put item 1 of tLine into x2
put item 2 of tLine into y2
put item 3 of tLine into x3
put item 4 of tLine into y3
put item 1 of tP into x1
put item 2 of tP into y1
if x3-x2 is 0 then
return (x1-x2)
else
put (y3-y2)/(x3-x2) into m -- The slope
return (m*(x1-x2)-(y1-Y2))/sqrt(1+m*m)
end if
end perpDist
e f g h i p t { | d z " Pmfunction thePolyLines tPolyPoints repeat with i = 1 to the number of lines in tPolyPoints put line i of tPolyPoints & comma & line i+1 of tPolyPoints & return after results end repeat delete last line of results return results end thePolyLines function perpDist tP,tLine put item 1 of tLine into x2 put item 2 of tLine into y2 put item 3 of tLine into x3 put item 4 of tLine into y3 put item 1 of tP into x1 put item 2 of tP into y1 if x3-x2 is 0 then return (x1-x2) else put (y3-y2)/(x3-x2) into m -- The slope return (m*(x1-x2)-(y1-Y2))/sqrt(1+m*m) end if end perpDist cREVGeometryCacheIDs 1108343705619 60361108395006710 60381108511492272 60431108506874770 60421108343966445 60371108498536155 60401108498536156 60411109350115241 61791108942517596 60971108498307386 60461108899014881 60441108430058696 60391107870321097 60451108942420955 60951108342633221 60351108942503466 60961108342523075 60341108340866467 6033 cREVGeometryCache order total 18 cREVGeneral scriptChecksum *ˎ$)R饍 bookmarks breakPoints handlerList thePolyLines perpDistscriptSelection char 1 to 256prevHandler thePolyLinestempScript scriptfunction thePolyLines tPolyPoints
repeat with i = 1 to the number of lines in tPolyPoints
put line i of tPolyPoints & comma & line i+1 of tPolyPoints & return after results
end repeat
delete last line of results
return results
end thePolyLines
function perpDist tP,tLine
put item 1 of tLine into x2
put item 2 of tLine into y2
put item 3 of tLine into x3
put item 4 of tLine into y3
put item 1 of tP into x1
put item 2 of tP into y1
if x3-x2 is 0 then
return (x1-x2)
else
put (y3-y2)/(x3-x2) into m -- The slope
return (m*(x1-x2)-(y1-Y2))/sqrt(1+m*m)
end if
end perpDist
# P Ffunction ProjPointLiesWithinEndPts tProjPt,tLine put item 1 to 2 of tLine into tLinePt1 put item 3 to 4 of tLine into tLinePt2 put theTwoPtDist(tLinePt1,tLinePt2) into L put theTwoPtDist(tProjPt,tLinePt1) into s1 put theTwoPtDist(tProjPt,tLinePt2) into s2 if s1 < L and s2 < L then return true else return false end ProjPointLiesWithinEndPts end tDistProjPtFromEitherEnd function theDistPtAndEndPoints p1,tLine put item 1 to 2 of tLine into p2 put item 3 to 4 of tLine into p3 put theTwoPtDist(p1,p2) into s1 put theTwoPtDist(p1,p3) into s2 return s1+s2 end theDistPtAndEndPoints function theTwoPtDist p1,p2 put item 1 of p1 into x1 put item 2 of p1 into y1 put item 1 of p2 into x2 put item 2 of p2 into y2 return sqrt((x2-x1)^2 + (y2-y1)^2) end theTwoPtDist on changeToReflectedVel tLine put item 1 to 2 of tLine into p1 put item 3 to 4 of tLine into p2 put the loc of me into tLoc put theTwoPtDist(tLoc,p1) into d1 put theTwoPtDist(tLoc,p2) into d2 if d1