From: Bruce S. <Bru...@nc...> - 2006-03-29 04:46:13
|
Also, in case you didn't spot this, look at the Visual documentation on the box object and the accompanying diagram. Bruce Sherwood Jonathan Brandmeyer wrote: >On Mon, 2006-03-27 at 23:20 +0000, Miles Jacobs wrote: > > >>I've tried to make VPython work with PyODE (http://pyode.sourceforge.net). >>The blocks seem to collide properly but they often settle on their edges. I >>probably misunderstand the rotation matrix provided by PyODE or the "up" >>method of VPython. >> >> > >Both up and axis define the orientation of a VPython body ("angle" is >not used for anything). See src/prim.cpp for the full story (there are >some corner cases that the code follows to avoid degeneration). The >following is a reasonable approximation of what happens in there: > ># Returns the direction cosine matrix of a VPython renderable body ># The result is a right-handed 3x3 orthonormal matrix >def DCM( renderable): > z_axis = renderable.axis.cross( renderable.up).norm() > y_axis = z_axis.cross( renderable.axis).norm() > x_axis = renderable.axis.norm() > # Can probably use Tensor here... > ret = Numeric.array( shape=(3,3), type=Numeric.Float64) > ret[:,0] = x_axis > ret[:,1] = y_axis > ret[:,2] = z_axis > return ret > ># Set the orientation of a renderable object from a 3x3 direction ># cosine matrix, while retaining scaling information on the Visual ># object. ># renderable: A VPython renderable object ># DCM: A right-handed 3x3 orthonormal matrix ># returns: None >def move_renderable_from_DCM( renderable, DCM): > renderable.axis = vector(DCM[:,0]) * renderable.axis.mag > renderable.up = vector(DCM[:,1]) > > > >> Any help would be appreciated. The VPython "cubes" get >>their positional and angular information from the PyODE "bodies". >> >> > >HTH, >-Jonathan > > > > >------------------------------------------------------- >This SF.Net email is sponsored by xPML, a groundbreaking scripting language >that extends applications into web and mobile media. Attend the live webcast >and join the prime developer group breaking into this new coding territory! >http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 >_______________________________________________ >Visualpython-users mailing list >Vis...@li... >https://lists.sourceforge.net/lists/listinfo/visualpython-users > > |