Vettori – Rotazioni – 2

Una freccia in ogni direzione delle 12 ore (ogni 30°)

from vpython import *

canvas(width=640, height=640)

FRECCE = []
NUMERO = 12
DELTA  = tau/NUMERO
for angolo in arange(0, tau, DELTA):
    f=arrow()
    f.rotate(angle=angolo, axis=vector(0,0,1))
    FRECCE.append(f)

from vpython import *

canvas(width=640, height=640)

FRECCE = []
NUMERO = 12
DELTA  = tau/NUMERO
for angolo in arange(0, tau, DELTA):
    f=arrow()
    f.rotate(angle=angolo, axis=vector(0,0,1))
    FRECCE.append(f)
    
while(True):
    rate(30)    
    for f in FRECCE:
        f.rotate(angle=pi/100)

Le 12 frecce ruotano intorno al loro asse di default, l’asse x


from vpython import *

canvas(width=640, height=640)

FRECCE = []
NUMERO = 12
DELTA  = tau/NUMERO
for angolo in arange(0, tau, DELTA):
    f=arrow()
    f.rotate(angle=angolo, axis=vector(0,0,1))
    FRECCE.append(f)
    
while(True):
    rate(30)    
    for f in FRECCE:
        f.rotate(angle=pi/100, axis=vector(0,0,1))

Le 12 frecce ruotano intorno all’asse z: vector(0,0,1).

In senso antiorario.

Lascia un commento