3D Translation in Python

Charles Krug charles at pentek.com
Fri Aug 30 23:11:34 CEST 2002

On 30 Aug 2002 12:58:44 -0700, Luis Torres <dsteel1 at tampabay.rr.com> wrote:
> Is it possible to translate a 3D point from one x,y,z axis to another
> defined x,y,z, axis?

> Seems very complicated, all the geometric equations I have seen on the
> net solve it by using Matrix Calculations.

Because that's how it's done.

Linear Algebra is considered an "elementary" subject in mathematics.
Nevertheless, a lot of folks consider it difficult.  I listened to dozens of
folks telling he how "hard" it was before I took it and realized it wasn't so
bad at all, provided I studied.

For the record, I found Discrete Mathematics and Modern Algebra "hard."
Cawley's Theorum anyone?

Anyway, any current linear algebra text will have a section on coordinate
transforms.  It's probably a good idea to read such a book and work through a
few examples.

What you wind up doing is taking the basis vectors of the one coordinate
system (unit vectors in x1, y1, z1) and translating them into the coordinates
in (x2, y2, z2).  This gives you a matrix.  You take this matrix and its
inverse.  To go from system one to system two, you use the forward matrix.  To
reverse the process, use the inverse matrix.

When you start doing it on a computer, there are a number of simplifications
that apply specifically to the 3d transformation, and there's been a lot of
work in doing the translation from 3d to 2d (for display on a computer
monitor, for example).

Some of the "Games Programming" websites have implementations and explanations
of varying quality (it's important for shooters).

More information about the Python-list mailing list