I have been trying to figure out the way axis data of a frame works. Basically, I have a faces object inside a frame and I need to rotate it by some specified amounts and re-position somewhere else in space with a specific axial direction.
For a simple explanation of the problem, I provide some code below. Code begins with drawing three arrows in x,y, and z directions in order to improve the interpretability of the visual outcomes. "rod" is a red cylinder object whose pos and axis attributes are controlled clearly in a straightforward manner. Then I generate a similar cylinder (yellow one) with extrusion and create_faces() functions and put it inside a frame. The confusion begins when I change f.axis and observe the outcome. For example, variations like
do not work in the way it works for a cylinder object. It is probably related with "world space" and "frame space" coordinates mentioned in documentation page for faces. Since cylinder is an axisymmetric object, I also added a notch to the yellow cylinder to help me understand, but I could not understand it somehow.
Any explanations about the relation between changes of f.axis and visual outcomes are appreciated.
Also, I need to put my faces object in the space to a specified position and along a specified direction keeping its length fixed. For example, let the new position of the cylinder be (1,1,0) and its axis be (6.7735,6.7735,5.7735). This can easily be done for the red cylinder with the following codes:
rod.pos = (1,1,0)
rod.axis = (6.7735,6.7735,5.7735)
How can I get the same positioning for the yellow cylinder?
from visual import *
scene.autocenter = True
arrow(pos = vector(0,0,0), axis = vector(2,0,0), color = color.red) # x-axis
arrow(pos = vector(0,0,0), axis = vector(0,2,0), color = color.green) # y-axis
arrow(pos = vector(0,0,0), axis = vector(0,0,2), color = color.blue) # z-axis
rod = cylinder(pos=(0,0,0), axis=(0,0,10), radius=1, color = color.red) # generate red cylinder
f = frame()
my_circle1 = shapes.circle(pos=(0,0), radius=1)
my_circle2 = shapes.circle(pos=(0.9,0), radius=0.2)
extr_cylinder = extrusion(pos=[(0,3,0),(0,3,10)], shape=my_circle1 + my_circle2, color=color.yellow)
faces_cylinder = extr_cylinder.create_faces() # generate faces object
faces_cylinder.frame = f # put the faces object into the frame
## change axis of frame
f.axis = (0,10, 0)
## change position of red cylinder
#rod.pos = (1,1,0)
#rod.axis = (6.7735,6.7735,5.7735)