From: Bruce S. <Bru...@nc...> - 2008-01-05 23:43:43
|
I agree that we need ways to move between frame and scene coordinates. I too have tripped over these missing links. Moving from frame to frame seems to me a rather different and more complex issue. Bruce Sherwood Ron Adam wrote: > I want to add a vector in world relative coordinates to objects in a > rotated frame. It first needs to be translated to frame coordinates. > > I can do this for single axis, but when the frame rotation involves > rotation of more than one axis, I can't seem to get it correct. > > > It would be nice to have these three functions ... > > > # The current world_space_function. > > def frame_to_world_pos(pos, frame): > """ Frame position in world space coordinates. """ > x_axis = norm(frame.axis) > z_axis = norm(cross(frame.axis, frame.up)) > y_axis = norm(cross(z_axis, x_axis)) > return frame.pos+pos.x*x_axis+pos.y*y_axis+pos.z*z_axis > > > def world_to_frame_pos(pos, frame): > """ World position in frame space coordinates. """ > ??? > return frame_pos > > > def frame_to_frame_pos(pos, frame1, frame2): > """ Frame position in other frame space coordinates. """ > wpos = frame_to_world_pos(pos, frame1) > return world_to_frame_pos(wpos, frame2) > > > Is there an easy way to move objects from frame to frame and keep their > orientation relative to world space? > > > Thanks, Ron > > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users > |