# Linear Tranformation (rotation)
n=20
fastgraphics
Dim v (2,n)
Dim f (2,n)
Dim t (2,2)
# Initial vectors V
for i = 1 to n-1
v[0,i]=rand*100:v[1,i]=rand*100
next i
# Changing a
for a = 1 to 2*pi step .001
gosub rot
gosub mult
gosub plotting
next a
# Transformation Matrix
rot:
t[0,0]=cos(a):t[0,1]=-sin(a)
t[1,0]=sin(a):t[1,1]=Cos(a)
return
# F=V*T
mult:
for i = 1 to n-1
f[0,i]= v[0,i]*t[0,0]+v[1,i]*t[1,0]
f[1,i]= v[0,i]*t[0,1]+v[1,i]*t[1,1]
next i
return
# Ploting F
plotting:
clg
line 0,150,300,150
line 150,0,150,300
for i = 1 to n-1
circle f[0,i]+150,150-f[1,i],4
next i
refresh
return
No comments:
Post a Comment