![]() |
|
|
|
#1
|
|||
|
|||
|
Sure, no problem to generate wrl. The problem is that the translation and rotation in WRML differ from Vizard. As to translation, WRML has opposite Z direction. More difficult situation is for rotation: since I have top (p1) and bottom (p2) cylinder positions in Vizard, to get WRML rotation parameters I tried
vizmat.LookToQuat(vizmat.VectorToPoint(p1,p2)) and vizmat.QuatToAxisAngle(vizmat.LookToQuat(vizmat.Ve ctorToPoint(p1,p2))) but both variants produces something mysterious. Could you help? |
|
#2
|
|||
|
|||
|
The VRML rotation field is an axis-angle rotation. To convert a Vizard axis-angle rotation to a VRML axix-angle rotation, you will need to negate the x,y components of the axis vector and convert the degrees to radians. Here is a function that will return the VRML rotation of a cone given the bottom and top points of the cone:
Code:
def getVRMLConeRotation(bottom,top): v = viz.Vector(top) v -= bottom m = viz.Matrix() m.makeVecRotVec([0,1,0],v) r = m.getAxisAngle() return -r[0],-r[1],r[2],viz.radians(r[3]) |
|
#3
|
|||
|
|||
|
Thank you, now the result is not misterious. But when I add saved WRL back to Vizard I get the cylinder mirrored from X axis in respect to the original one. Is it because of the reverse convertion while adding?
|
|
#4
|
|||
|
|||
|
I tested it out here and it seems to work fine. Can you provide a sample script that recreates your problem?
|
|
#5
|
|||
|
|||
|
Thank you again, I already found the bug, it works normal.
|
![]() |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| saving the scene | giancamati | Vizard | 1 | 12-21-2006 09:25 AM |
| saving the position | poolshark | Vizard | 3 | 09-26-2003 01:57 PM |