COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### Transformation matrix for a coordinate system given by tree points

• Email
• Follow

```I got three points A, B ,C that defines a custom (local) coordinate system:

A defines the origin of the local coordinate system, B defines the x-axis
and C is a point on the xz plane.

How can I derive the transformation matrix that translates from the world
coordinate system and into the local coordinate system -and opposite. Say I
want the global xyz values of the point P given by the local coordinates P =
(3,4,1).

Thanks a LOT, also for links to good documentation!

Teis

```
 0

See related articles to this posting

```Teis Draiby wrote:
> I got three points A, B ,C that defines a custom (local) coordinate system:
>
> A defines the origin of the local coordinate system, B defines the x-axis
> and C is a point on the xz plane.
>
> How can I derive the transformation matrix that translates from the world
> coordinate system and into the local coordinate system -and opposite. Say I
> want the global xyz values of the point P given by the local coordinates P =
> (3,4,1).
>
>

gluLookat() will do it. The "up" vector is really just a
point on the xz plane.

--
<\___/>          For email, remove my socks.
/ O O \
\_____/  FTB.    Why isn't there mouse-flavored cat food?

```
 0

```Teis Draiby wrote:
> To be more specific, it is especially the rotation transformations I am
> unsure how to derive. Probably very simple.
>

The rows of a rotation matrix are simply the
X, Y and Z axes of your coordinate system.

ie. Take the "forward" vector, normalize it
to length=1, put it in the third row of your
matrix (assuming Z axis="forward").

Similarly for "right" and "up".

--
<\___/>          For email, remove my socks.
/ O O \
\_____/  FTB.    Why isn't there mouse-flavored cat food?

```
 0