Rotating a cube
norseman
norseman at hughes.net
Thu Jul 17 21:04:43 CEST 2008
J-Burns wrote:
> Hello. Need some help here. I have a 4*4 cube. So the equation of the
> cube becoming:
>
> x + 4*y + 16*z
>
> Now i want to rotate this cube 90 degrees anticlockwise( a right
> rotation). How can i do that? The rotation must take place with the
> axis of rotation being the straight line through the center of the
> cube and perpendicular to the "xz-plane." The axis are aligned in this
> fashion:
>
> y
> |
> |
> |________ x
> /
> /
> z
>
> Moreover, also tell me how to perform a rotation with the axis of
> rotation being the straight line through the center of the cube and
> perpendicular to the "yz-plane."
>
> Essentially, I need the equations of the lines after the rotation has
> been done in both cases.
> Is there a built in Python function for this?
> --
> http://mail.python.org/mailman/listinfo/python-list
>
======================================
OH-Boy!
1) a regular cube is dimensioned having three mutually perpendicular
axis, each of same length. The 4x4 would be for a plane.
2) Clockwise IS Angles Right. (Rotate to right.)
Normal Angles Right would put zero at +Y, 90 at +X as viewed from +Z.
Norman Angles Right would put zero at +Z, 90 at +Y as viewed from +X.
Normal Angles Right would put zero at +Z, 90 at -X as viewed from +Y.
(there are six faces, finish the defs for the rest.)
3) Normally all rotations are defined as pivoting about the 0,0,0 point.
To use center of a plane or other pivot point is to add offsets.
4) Sequence of rotations controls final spatial orientation.
As for finding a cube handling graphic in the standard package download,
I did not. Somebody else can answer if there is a full blown Python
vector graphic package.
At a minimum you need to define a:
rotational routine that handles N 3D points as a single bundle.
The usual routines consider each rotation as being about a single axis.
It computes all N corners each time.
translation routine that moves N 3D points as a single bundle along a
single 3D vector.
It computes all N corners each time.
scaler routine that expands/contracts the relative distances between
the N 3D points using vectors from the computed 3D center.
It computes all N corners each time.
Some pre-/post routines to put things together to get the desired effects.
If N=0 (the nothing) there is nothing to do.
If N=1 (the point) there is no rotation or scale.
If N>1 (the line,plane,box,sphere,torus,etc.) then use all three.
(a sphere can be computed as three points of an isosceles triangle in
which the third side can equal the other two. The points then are used
to create a circle (ellipse) which is rotated about the third side.
In case it isn't obvious - the perpendicular bisector of the third side
is the center of the sphere. To track a point on a sphere is simply to
use 4 points. 0,1,2 are triangle and 3 is the point. Do your thing on
all 4, use 0,1,2 to remake sphere and 3 will be right place.)
The Chemical Rubber Company's Handbook of Physics and Chemistry is a
good starting point for the equations. Johnny, George, Willie and I
also used a few Celestial Mechanics books from the Library when we wrote
those in assembly in the long ago and far away. (back in the '60s on the
other side of the continent.) Sorry, but the punch cards disappeared
long ago and access to CAD programs deletes my need to re-write them.
Steve
norseman at hughes.net
More information about the Python-list
mailing list