Windowtitle "Multi-Gummipendel"'(CL)CopyLeft 2014-03 by P.Pájaro carpintero, Wien
Windowstyle 24:Ventana 0,0-%maxx,%maxy-40' Keine sin embargo geartete Gewähr!
randomize:var col&=rgb(200+rnd(56),200+rnd(56),200+rnd(56))
var xx&=width(%hwnd):var yy&=height(%hwnd):var xh!=xx&/2:var yh!=yy&/2:var zoom!=2000
declarar x!,y!,dx!,dy!,fk!,mx!,my!,m!,fx!,fy!,ax!,ay!,vx!,vy!,g!,t!,wind!
declarar x2!,y2!,dx2!,dy2!,fk2!,mx2!,my2!,m2!,fx2!,fy2!,ax2!,ay2!,vx2!,vy2!
declarar x3!,y3!,dx3!,dy3!,fk3!,mx3!,my3!,m3!,fx3!,fy3!,ax3!,ay3!,vx3!,vy3!
declarar x4!,y4!,dx4!,dy4!,fk4!,mx4!,my4!,m4!,fx4!,fy4!,ax4!,ay4!,vx4!,vy4!
g! =9.80665'm/s²
t! =0.01'Zeitschritt
fk!=0.5'zoom*N/m
m! =4.8'kg
fk2!=0.5'zoom*N/m
m2! =4.8'kg
fk3!=0.4'zoom*N/m
m3! =4.8'kg
fk4!=0.4'zoom*N/m
m4! =4.8'kg
MCLS xx&,yy&
REPEAT
mx!=%mousex-xh!- x!*zoom!
my!=yh!-%mousey- y!*zoom!
dx!=mx!-x! : dy!=my!-y!
Fx!=dx!*fk!+Fx2!*t! : Fy!=dy!*fk!+Fy2!*t!
ax!=Fx!/m! : ay!=Fy!/m! - g!'Gravitation
' wind!=(rnd(90)-rnd(70))/zoom!
vx!=vx!+.5*ax!*t!+wind! : vy!=vy!+0.5*ay!*t!
vx!=vx!*0.99 : vy!=vy!*0.99
x!=x!+vx!*t!: y!=y!+vy!*t!
mx2!=(x!-x2!)*zoom!
my2!=(y!-y2!)*zoom!
dx2!=mx2!-x2! : dy2!=my2!-y2!
Fx2!=dx2!*fk2!+Fx3!*t! : Fy2!=dy2!*fk2!+Fy2!*t!
ax2!=Fx2!/m2! : ay2!=Fy2!/m2! - g!'Gravitation
vx2!=vx2!+.5*ax2!*t! : vy2!=vy2!+.5*ay2!*t!
vx2!=vx2!*0.92 : vy2!=vy2!*0.92
x2!=x2!+vx2!*t!: y2!=y2!+vy2!*t!
mx3!=(x2!-x3!)*zoom!
my3!=(y2!-y3!)*zoom!
dx3!=mx3!-x3! : dy3!=my3!-y3!
Fx3!=dx3!*fk3! : Fy3!=dy3!*fk3!
ax3!=Fx3!/m3! : ay3!=Fy3!/m3! - g!'Gravitation
vx3!=vx3!+.5*ax3!*t! : vy3!=vy3!+.5*ay3!*t!
vx3!=vx3!*0.92 : vy3!=vy3!*0.92
x3!=x3!+vx3!*t!: y3!=y3!+vy3!*t!
mx4!=(x3!-x4!)*zoom!
my4!=(y3!-y4!)*zoom!
dx4!=mx4!-x4! : dy4!=my4!-y4!
Fx4!=dx4!*fk4! : Fy4!=dy4!*fk4!
ax4!=Fx4!/m4! : ay4!=Fy4!/m4! - g!'Gravitation
vx4!=vx4!+.5*ax4!*t! : vy4!=vy4!+.5*ay4!*t!
vx4!=vx4!*0.92 : vy4!=vy4!*0.92
x4!=x4!+vx4!*t!: y4!=y4!+vy4!*t!
StartPaint -1:ClS col&
usepen 0,1,0 : line xh!,0 - xh!,yy& : line 0,yh! - xx&,yh!
usepen 0,3,0 : line %mousex,%mousey - xh!+x!*zoom!,yh!-y!*zoom!
usepen 0,3,180 : line xh!+x2!*zoom!,(yh!-y2!*zoom!) - xh!+x!*zoom!,yh!-y!*zoom!
usepen 0,3,2220 : line xh!+x3!*zoom!,(yh!-y3!*zoom!) - xh!+x2!*zoom!,yh!-y2!*zoom!
usepen 0,3,66220 : line xh!+x4!*zoom!,(yh!-y4!*zoom!) - xh!+x3!*zoom!,yh!-y3!*zoom!
usepen 0,47,200 : line xh!+x!*zoom!,(yh!-y!*zoom!-1) - xh!+x!*zoom!,yh!-y!*zoom!
usepen 0,20,$9F0000 : line %mousex,%mousey - %mousex-1,%mousey
usepen 0,35,$9F00 : line xh!+x2!*zoom!,(yh!-y2!*zoom!-1) - xh!+x2!*zoom!,yh!-y2!*zoom!
usepen 0,35,$909F00 : line xh!+x3!*zoom!,(yh!-y3!*zoom!-1) - xh!+x3!*zoom!,yh!-y3!*zoom!
usepen 0,35,0 : line xh!+x4!*zoom!,(yh!-y4!*zoom!-1) - xh!+x4!*zoom!,yh!-y4!*zoom!
EndPaint
MCopyBMP 0,0-xx&,yy& > 0,0;0
waitinput 4
UNTIL %key=27
end