Jump to content
  • Advertisement
Sign in to follow this  

Transformation from local to global and global to local with some additional issue?

This topic is 2865 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts


1. Here the issue is to compute the global P(X,Y,Z) position w.r.t local L(x,y,z)
(origin of the local space of the cylinder).

=> means transform P(X,Y,Z) to P(x,y,z).

point "P" is located somewhere inside of the cylinder.

I did but I am not sure, there is something wrong.

Method 1:

| local P'x | | LI L4 L7 | | Px - Lx |
| local P'y |= | L2 L5 L8 | * | Py - Ly |
| local P'z | | L3 L6 L9 | | Pz - Lz |

Method 2:

first computed the transformation matrix of cylinder:
| L'x | | LI L4 L7 | |Lx|
| L'y | = | L2 L5 L8 | * |Ly|
| L'z | | L3 L6 L9 | |Lz|


| local P'x | | Px - L'x |
| local P'y | = | Py - L'y |
| local P'z | | Pz - L'z |

after that I want to again transform from local(L) to global(G).
=> means transform P(x,y,z) to P(X,Y,Z)

actually i want to change the position of point "P" inside of the cylinder. for this purpose i have to first transform "P" to local space (L) of the cylinder then I change the position of "P". finally again back to transform point "P" into global space (G). this is my issue.


[Edited by - luckyyyyyy on December 14, 2010 7:39:40 PM]

Share this post

Link to post
Share on other sites
In the following I'm using column vectors:

A point p given in the local space L is transformed into the parental (here global) space by
p' := L * p
where L is the homogeneous transformation matrix, e.g. assembled from a rotation and translation like
L := T * R
where the translation matrix is given by the origin of L.

You seem to want to deal with affine co-ordinates, so going on to the equivalent affine transformation means
p' := t + R * p

Converting from global to local obviously means to use the inverse of the above transformation:
p' - t = R * p
R-1 * ( p' - t ) = R-1 * R * p
so that at the end
R-1 * ( p' - t ) = p

Your Method 1 is the same in case that your L1..L9 matrix is in fact the inverse rotation matrix of L.

Due to
R-1 * ( p' - t ) = R-1 * p' - R-1 * t
and matching the terms against your Method 2, it seems that your L' is
L' = R-1 * t
and hence the right term above, but the left term cannot be found. So your Method 2 is wrong.

Share this post

Link to post
Share on other sites


thanks for your kind guidance. and sorry for late reply. actually i was trying to solve it out.
now you can see the problems in figures ?
The cylinder is covered with a bounding box. now how can i rotate that bounding box too with cylinder ?

first correct me, am i applying the correct equations?

I draw that bounding box:
bounding_box_X = L_x +(-) r
bounding_box_Y = L_y +(-) r
bounding_box_Z = L_z + Height_cylinder

Share this post

Link to post
Share on other sites
actually I can easy use AABB (Axis-aligned bound box) but i want to use here OBB(oriented bounding box) for collision detection.

guide me for OBB.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!