Transform Axes Jun 2021

Generally transforming coordinate axes

Here is yet another presentation about a VBA function that was recoded in Python.

In structural engineering, we must constantly deal with axes transformations.  Mostly we have right handed coordinates (RHC), but sometimes left handed coordinates (LHC). For example, LHCs might occur when South or East map coordinates are used. Certain engineering software packages use LHC.

A few quick questions:

  • How many XYZ orientations are there?
    (48)
  • How many RHC XYZ orientations are there?
    (24)
  • How many LHC XYZ orientations are there?
    (24)

Conceptual proof:

  • Imagine the XYZ system in your head
  • Label the directions X, Y, Z as 1, 2, 3
  • Label the directions -X, -Y, -Z as 4, 5, 6
  • Now imagine transforming X, Y, Z to X_{new}, Y_{new}, Z_{new}.
  • Let’s say X_{new} = X (∴ 1) and Y_{new} = Z (∴ 3)
  • We could use the two digit notation [13] for the new system orientation
  • There are 4 orientations starting with 1:
    • [12]: X_{new} = X, Y_{new} = Y
    • [13]: X_{new} = X, Y_{new} = Z
    • [15]: X_{new} = X, Y_{new} = -Y
    • [16]: X_{new} = X, Y_{new} = -Z
    • [11]: isn’t legal. X_{new} and Y_{new} must have different directions
    • [14]: isn’t legal. X_{new} and Y_{new} cannot be in opposite directions
  • Consider then two digit orientations 2_, 3_, 4_, 5_, 6_
  • For each of these we can have four orientations
  • Therefore, there are 24 RHC orientations; 6 choices for X_{new} times 4 choices for Y_{new}
  • Therefore, there are 24 RHC orientations
  • Then allow RHC or LHC orientations
  • Therefore, there are 24 LHC orientations
  • Therefore, there are 48 total orientations

This makes it almost trivial to think through the transformation desired.

Rotation about a Single Vector

Given a point (x, y, z), to make the RHC transformation we simply execute a single rotation about a single vector:

  • to produce [12]: rotate (x, y, z) zero degrees about vector (1, 1, 1) ## no change
  • to produce [15]: rotate (x, y, z) 180 degrees about vector (1, 0, 0)
  • to produce [13]: rotate (x, y, z) 90 degrees about vector (1, 0, 0)
  • to produce [16]: rotate (x, y, z) 270 degrees about vector (1, 0, 0)
  • to produce [43]: rotate (x, y, z) 180 degrees about vector (0, 1, 1)
  • to produce [46]: rotate (x, y, z) 180 degrees about vector (0, -1, 1)
Click here to link http://motion.cs.illinois.edu/RoboticSystems/3DRotations.html (see Item 5)
Screenshot
To make the LHC transformation we negate the Z-axis coordinate of the output point after rotating the point about the vector.
X_{new}, Y_{new}, Z_{new} \longrightarrow X_{new}, Y_{new}, -Z_{new}
The Final Function (with PDF)
For my transformation function, I predetermined the vectors and rotations for the 24 RHC orientations.

Using PyXLL, the function is callable from Excel.

Another example
Rotation matrix and rotation equation for [23]: X_{new} = Y (∴ 2) and Y_{new} = Z (∴ 3)
Matrix Transform Equation
Excel spreadsheet PDF
In row 19, notice that a single PyXLL function call takes a single orientation input [23], calculates the rotation matrix once, and performs a block of point transformations in a single matrix equation. Yep, that’s a screenshot from an iPhone.Screenshot
Click here to see full PDF
Mathematics Reference

Leave a Reply

Your email address will not be published. Required fields are marked *