![]() LOCATE( SUB(xc,y1), SUB( yc, x1) ), PRNL( Pen ) LOCATE( ADD(xc,y1), SUB( yc, x1) ), PRN( Pen ) LOCATE( SUB(xc,y1), ADD( yc, x1) ), PRN( Pen ) LOCATE( ADD(xc,y1), ADD( yc, x1) ), PRN( Pen ) LOCATE( SUB(xc,x1), SUB( yc, y1) ), PRN( Pen ) LOCATE( ADD(xc,x1), SUB( yc, y1) ), PRN( Pen ) LOCATE( SUB(xc,x1), ADD( yc, y1) ), PRN( Pen ) LOCATE( ADD(xc,x1), ADD( yc, y1) ), PRN( Pen ) STOR( DIV(dx, paso) DIV(dy, paso), dx, dy ) LOCATE (2, 55) PRNL("Press any key to quit")īACK-IF ( NOT( KEY-PRESSED? ), Animate All ) LET( speed := ADD( speed, DIV(accel, 100) ) ) LET( accel := MUL(g, SIN(theta) DIV-INTO(l) DIV-INTO(4) ) ) SET( theta, M_PI_2 ) // pi/2 constant -> flow.h Velocity * Float_Type ( Time ) end Update_Pendulum end Pendulums Velocity + Acceleration * Float_Type ( Time ) Item. Y end Get_Y procedure Update_Pendulum ( Item : in out Pendulum Time : in Duration ) is Acceleration : constant Float_Type := Gravitation / Item. ![]() X end Get_X function Get_Y ( From : Pendulum ) return Float_Type is begin return From. Velocity := 0.0 return Result end New_Pendulum function Get_X ( From : Pendulum ) return Float_Type is begin return From. With _Elementary_Functions package body Pendulums is package Math is new _Elementary_Functions (Float_Type ) function New_Pendulum ( Length : Float_Type Theta0 : Float_Type ) return Pendulum is Result : Pendulum begin Result. ![]() X and Y are relative positions of the pendulum to the anchor. If you want, you can replace the output method with graphical update methods. This does not use a GUI, it simply animates the pendulum and prints out the positions. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |