# Linear Transformation using a matrix T (enlargement by a scale factor of -1 )

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*150:v[1,i]=rand*150

next i

# Changing a

for a = 1 to -1 step -.001

gosub rot

gosub mult

gosub plotting

next a

# Transformation Matrix

rot:

t[0,0]=a:t[0,1]=0

t[1,0]=0:t[1,1]=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

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*150:v[1,i]=rand*150

next i

# Changing a

for a = 1 to -1 step -.001

gosub rot

gosub mult

gosub plotting

next a

# Transformation Matrix

rot:

t[0,0]=a:t[0,1]=0

t[1,0]=0:t[1,1]=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