# Translating a point between Cartesian Coord Systems

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

## Recommended Posts

Hi. My CAD program uses a world cartesian coordinate system, WCS. The User is able to define his own User Coordinate System, UCS which is defined by a new origin and an X-direction vector and a Y- direction Vector. All points are stored in WCS, but I need to convert between the 2. Example: UCS Origin: X=438.8587 Y=180.644 Z=0 X-Direction: X=0.9644 Y=0.2481 Z=0.0913 Y-Direction: X=0.8617 Y=0.5029 Z=0.0679 A point is at X=495.835 Y=203.1717 Z=43.2574 What are it's coordinates in th UCS? Many thanks, Dave Coventry

##### Share on other sites
First you need to construct the world matrix for your "UCS" transform. You need the Z axis which can be found by taking the cross of X and Y, and then arranging them as columns in a 4x4 matrix (with translation in the last column).

so then you have:
0.9644	0.8617	-0.029	438.85870.2481	0.5029	0.0131	180.64400.0913	0.0679	0.2712	0.00.0000	0.0000	0.0000	1.0

You're looking to transform the point in world-space by the INVERSE of this matrix to go into UCS space. To invert a 4x4 matrix that has only rotation and translation, you transpose the 3x3 portion which is the rotation, and then multiply the negative translation by that transposed 3x3 matrix and those combine to yield the inverse.

So you multiply your point by the resulting matrix:
0.9644	0.2481	0.0913	-468.053     495.8350.8617	0.5029	0.0679	-469.010  *  203.1717-.0290	0.0132	0.2712	  10.374      43.25740.0000	0.0000	0.0000	   1.0         1.0

and that will give the point in the local coordinate system.

##### Share on other sites

I've tried as you suggest and have the following results, which don't appear to be correct:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
UCS Origin X Vector X unit Vector Y Vector Y unit Vector Z Vector Z unit Vector
438.86 528.29 0.9644 463.38 0.8459 -8560.4229 -0.1064
180.64 135.89 0.2481 270.45 0.4937 3878.8991 0.0482
0 50 0.0913 36.51 0.0667 79904.8204 0.9932
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Matrix
0.96 0.85 -0.11 438.86
0.25 0.49 0.05 180.64
0.09 0.07 0.99 0
0 0 0 1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MatrixTransposed Point NewPoint
0.96 0.25 0.09 -468.06 495.84 64.49
0.85 0.49 0.07 -460.44 203.17 62.2
-0.11 0.05 0.99 37.99 43.26 37.99
0 0 0 1 1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The Above is taken from a spreadsheet with the calculation cells as below:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
UCS Origin X Vector X unit Vector Y Vector Y unit Vector Z Vector Z unit Vector
438.86 528.29 =B2/SQRT($B$2*$B$2+$B$3*$B$3+$B$4*$B$4) 463.38 =D2/SQRT($B$2*$B$2+$B$3*$B$3+$B$4*$B$4) =B3*D4-D3*B4 =F2/SQRT($F$2*$F$2+$F$3*$F$3+$F$4*$F$4)
180.64 135.89 =B3/SQRT($B$2*$B$2+$B$3*$B$3+$B$4*$B$4) 270.45 =D3/SQRT($B$2*$B$2+$B$3*$B$3+$B$4*$B$4) =B4*D2-D4*B2 =F3/SQRT($F$2*$F$2+$F$3*$F$3+$F$4*$F$4)
0 50 =B4/SQRT($B$2*$B$2+$B$3*$B$3+$B$4*$B$4) 36.51 =D4/SQRT($B$2*$B$2+$B$3*$B$3+$B$4*$B$4) =B2*D3-D2*B3 =F4/SQRT($F$2*$F$2+$F$3*$F$3+$F$4*$F$4)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Matrix
=C2 =E2 =G2 =A2
=C3 =E3 =G3 =A3
=C4 =E4 =G4 =A4
0 =E5 =G5 1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Matrix Point NewPoint
=A7 =A8 =A9 =-D7*A13+-D8*B13+-D9*C13 495.84 =F13*A13+F14*B13+F15*C13+F16*D13
=B7 =B8 =B9 =-D7*A14+-D8*B14+-D9*C14 203.17 =F13*A14+F14*B14+F15*C14+F16*D14
=C7 =C8 =C9 =-D7*A15+-D8*B15+-D9*C15 43.26 =F13*A15+F14*B15+F15*C15+F16*D15
0 =E11 =G11 1 1 =F13*A16+F14*B16+F15*C16+F16*D16
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I realise that I'm taking huge liberties here and I beg your indulgence.

Many thanks,

Dave Coventry

##### Share on other sites
Sorry about the mangled text. It should still import into Open Office Calc (or Excel) if you set the delimeter as 'space'.

• 17
• 11
• 15
• 9
• 49
• ### Forum Statistics

• Total Topics
631393
• Total Posts
2999772
×