Vettori – Rotazioni – 1

Una freccia standard (direzione verso destra, colore bianco, posizione centrale, …)

from vpython import *
 
c = canvas(width = 640, height = 640)
f = arrow()

from vpython import *

c = canvas(width = 640, height = 640)
f = arrow()

while(True):
    rate(30)    
    f.rotate(angle = pi/100)

La freccia ruota intorno al suo asse di default, l’asse x


from vpython import *
 
c = canvas(width = 640, height = 640)
f = arrow()
 
while(True):
    rate(30)    
    f.rotate(angle = pi/100, 
             axis  = vector(0, 1, 0))

La freccia ruota intorno all’asse verticale y: vector(0,1,0)


from vpython import *
 
c = canvas(width = 640, height = 640)
f = arrow()
 
while(True):
    rate(30)    
    f.rotate(angle = pi/100, 
             axis  = vector(0, 0, 1))

La freccia ruota intorno all’asse z: vector(0,0,1).
Come una lancetta in senso antiorario.

Lascia un commento