Frequently asked questions

The following are frequently asked questions about coordinate transformation.

How are positions transformed between coordinate systems? And how do I know the transformed positions are correct?

We are explaining ACS-MCS and MCS-PCS separately.

ACS to MCS

ACS-MCS transformation supports only translation (linear movement). The following figure shows how the transformation is done:

In this figure, we can see two origins in ACS and MCS. The MCS origin is (4, 3, 6) in ACS, and the ACS origin is (-4, -3, -6) in MCS.

ACS MCS
(0, 0, 0) (-4, -3, -6)
(4, 3, 6) (0, 0, 0)

When we transform ACS into MCS, we tell KINGSTAR how many units we want to translate on X, Y, Z axis individually and use that position as the MCS origin. If we give the value (4, 3, 6) in SetKinTransform, it means we want to use this ACS point as the MCS origin. When we transform ACS (0, 0, 0) into MCS, the result is (-4, -3, -6).

The equation of ACS-MCS transformation:

ACS = MCS + Translation

ACS.X = MCS.X + Trans.X -> 0 = -4 + 4

ACS.Y = MCS.Y + Trans.Y -> 0 = -3 + 3

ACS.Z = MCS.Z + Trans.Z -> 0 = -6 + 6

MCS to PCS

MCS-PCS transformation supports translation and rotation. The following figure shows how the transformation is done:

In this figure, we can see two origins in MCS and PCS. These are the values for translation and rotation:

Rotation: X: 30° Y: 45° Z: 30°

Translation: X: 4 Y: 3 Z: 6

When we transform MCS into PCS, we tell KINGSTAR how many units we want to rotate and translate on X, Y, Z axis individually and use that position as the PCS origin. If we give the value (4, 3, 6, 30, 45, 30) in SetCartesianTransform, it means we want to use this rotated and translated MCS point as the PCS origin.

In KINGSTAR, when MCS is transformed into PCS, the position is rotated first, and then translated, so we need to calculate the rotation first. We use rotation matrix to calculate the PCS position. Because the order of rotation in KINGSTAR is Z, Y, X, we need to multiply the matrix in ZYX order.

The following is the Rot.Z x Rot.Y x Rot.X matrix.

C: degrees of Z-axis rotation

B: degrees of Y-axis rotation

A: degrees of X-axis rotation

 

To get the rotated coordinate, we need to use this matrix:

MCS PCS
X: MCS.X x: PCS.X
Y: MCS.Y y: PCS.Y
Z: MCS.Z z: PCS.Z

 

Expand the matrix to equations:

X = (cosCcosB)x + (-sinCcosA + cosCsinBsinA)y + (sinCsinA + cosCsinBcosA)z

Y = (sinCcosB)x + (cosCcosA + sinCsinBsinA)y + (-cosCsinA + sinCsinBcosA)z

Z = (-sinB)x + (cosBsinA)y + (cosBcosA)z

 

Don't forget the translation. After the translation is added, we get these transform equations:

X = (cosCcosB)x + (-sinCcosA + cosCsinBsinA)y + (sinCsinA + cosCsinBcosA)z + Trans.X

Y = (sinCcosB)x + (cosCcosA + sinCsinBsinA)y + (-cosCsinA + sinCsinBcosA)z + Trans.Y

Z = (-sinB)x + (cosBsinA)y + (cosBcosA)z + Trans.Z

 

Subsitute our translation and rotation values into the equations:

X = (cos30°cos45°)x + (-sin30°cos30° + cos30°sin45°sin30°)y + (sin30°sin30° + cos30°sin45°cos30°)z + 4

Y = (sin30°cos45°)x + (cos30°cos30° + sin30°sin45°sin30°)y + (-cos30°sin30° + sin30°sin45°cos30°)z + 3

Z= (-sin45°)x + (cos45°sin30°)y + (cos45°cos30°)z + 6

 

We get this result:

0 = 0.612372436x - 0.126826484y + 0.780330086z + 4

0 = 0.353553391x + 0.926776695y - 0.126826484z + 3

0 = −0.707106781x + 0.353553391y + 0.612372436z + 6

 

The equations look complex because when we use trigonometric functions to calculate, many values are irrational number. If you want to use a pen and paper to solve the equations, it's better to get a calculator. To simplify the equations, you can round the number to a specific decimal place, such as third, but it will affect the result. The more decimal places you keep, the more precise the result. You can also use the math library on the internet to do the calculation, such as Eigen. Either way, you can verify the result in KINGSTAR.

 

After you solve the equations, you get the PCS position (x, y, z). The following table shows the MCS and PCS positions:

MCS PCS
(0, 0, 0) (0.732491, -4.394344, -6.415076)
(4, 3, 6) (0, 0, 0)

 

The equation of MCS-PCS transformation:

MCS = Rotation x PCS + Translation

MCS.X = Rot.X x PCS.X + Trans.X

MCS.Y = Rot.Y x PCS.Y + Trans.Y

MCS.Z = Rot.Z x PCS.Z + Trans.Z

 

Output: