From: Bruce S. <Bru...@nc...> - 2011-06-17 13:39:45
|
>From the VPython documentation ("Rotations") appended below, you can see that you can specify an origin for the rotation, so you could use the same origin for both objects. Alternatively, you might prefer to put both objects in a "frame", and then rotate the frame. The advantage to using a frame is that you can then treat the two objects as one in every way. For example, if you change the pos of the frame, both objects will move. Bruce Sherwood ------------------------------------ Objects other than curve, convex, faces, and points can be rotated about a specified origin (to rotate these other objects, put them in a frame and rotate the frame). obj.rotate(angle=pi/4, axis=axis, origin=pos) The rotate function applies a transformation to the specified object (sphere, box, etc.). The transformation is a rotation of angle radians, counterclockwise around the line defined by origin and origin+axis. By default, rotations are around the object's own pos and axis. There are no defaults for the extrusion object, and one must specify all parameters: angle, axis, and origin. On Fri, Jun 17, 2011 at 7:00 AM, Ershad K <ers...@gm...> wrote: > Hai, > > I'm new to vpython. I've two objects, a cube and a pyramid. After > changing the position of pyramid from its origin, could you tell me how > to rotate both objects combined? I tried > > cube.rotate(angle=45, axis=(0,1,0)) > pyr.rotate(angle=45, axis=(0,1,0)) > > But it's rotating on two different axis of its on. I would like to have > something like two objects sticked together and having rotation. > > Could you please help me to do so? > > Thanks in advance. > > Kind regards, > Ershad K > > ------------------------------------------------------------------------------ > EditLive Enterprise is the world's most technically advanced content > authoring tool. Experience the power of Track Changes, Inline Image > Editing and ensure content is compliant with Accessibility Checking. > http://p.sf.net/sfu/ephox-dev2dev > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users > |