gespeichert von dp am 23.August 98 um 18:39:24:
Examples of how to move sprites using trig functions are at:
It's no big secret; here are some trig functions, including arcSine and arcCosine:
on degreesToRadians degrees return pi() * degrees / 180 end -- on radiansToDegrees radians return radians * 180 / pi() end -- on cosine degrees return cos( degreesToRadians( degrees )) end -- on sine degrees return sin( degreesToRadians( degrees )) end -- on tangent degrees
return tan( degreesToRadians( degrees ))
end
--
on arcSine sine
return radiansToDegrees( atan( sine / sqrt(1 - power( sine, 2))))
end
--
on arcCosine cosine
return radiansToDegrees( atan( sqrt(1 - power( cosine, 2)) / cosine))
end
--
on arcTangent tangent
return radiansToDegrees( atan( tangent ))
end
--
on degrees theta
if theta > 360 then
put theta - 360 into theta
else if theta < 0 then
put 360 + theta into theta
end if
return theta
end
--another bit (by Jorge Peña): > Does anyone have Lingo functions for hyperbolic cosine and hyperbolic sine-- "cosh" and "sinh"? (Danny?) I don't think that direct functions are built in Director... You could calculate them from their mathematical definitions: sinh(x)=(1/2) * ((e^x) - (e^(-x))) cosh(x)=(1/2) * ((e^x) + (e^(-x)))
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Home | me | Director | Lingo Toolbox | Shocklet Gallery | shock + cgi | Contact |
D. Plänitz