Rope/Chain Catenary by The Exponentiator3rd Jul 2006 10:12
|
---|
Summary The catenary - the hyperbolic cosine graph showing the curve formed by a heavy, uniform chain or rope. Description The catenary - the hyperbolic cosine graph showing the curve formed by a heavy, uniform chain or rope. the equation is: c*hcos(x/c), the value of c is changed using the cursor keys. Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com c#=1 t=0 `line 320,0,320,480 `line 0,240,640,240 in: cls set cursor 10,10 Print c# set cursor 10,240 Print "CATENARY" Print "Using the hyperbolic cosine" Print "the curve formed by a uniform chain can be reached" Print "aimed at everyone who thought hyperbloic functions" Print "were utterly pointless :-)" Print "-------------------------------------------------------" Print "HELP" Print "use the cursor keys to change constant on the caternary" Print "-------------------------------------------------------" for x#=-90.0 to 90.0 y#=c#*hcos(x#/c#) ry#=y#*-50+(c#*hcos(0/c#)+240) rx#=x#+320 dot rx#,ry#,RGB(255,255,255) next x# circle (-90+320),c#*hcos(-90.0/c#)*-50+(c#*hcos(0/c#)+240),15 circle (90+320),c#*hcos(90.0/c#)*-50+(c#*hcos(0/c#)+240) ,15 do if upkey()=1 AND t=0 AND c#<4 then c#=c#+0.1 : t=40 : goto in if downkey()=1 AND t=0 AND c#>0.7 then c#=c#-0.1 : t=40 : goto in if t>0 t=t-1 endif loop cls |