Skip to content

Orientation

Duncan Calvert edited this page Oct 7, 2021 · 7 revisions

Introduction

Orientation describes the geometric transformation of an object from one placement in space to another, often in the mathematical form of a matrix or quaternion.

Before applying this concept with Euclid, it is important to emphasize that orientation is divorced from all other transformative effects. Changes in position, scaling, and reflection address other aspects of an object’s spatial relationships. Orientation strictly refers to transformations where an object has rotated around one or more of its internal axes to arrive at a new placement.

Consider an umbrella on a rainy day. If the umbrella is held steady, at the best angle to protect the bearer from the rain, would a winding journey affect the umbrella’s orientation? This depends on the definition of the object’s starting placement: orientation does not exist without a frame of reference.

If the bearer began their journey facing north, and the umbrella’s placement was defined relative to the earth, then any turn along the route would affect the umbrella’s orientation: a ninety degree turn would correspond to a ninety degree displacement around the vertical axis.

However, if the reference frame for placement is defined relative to the person carrying the umbrella, the placement would be identical from the start of the journey to the end. The body and the umbrella would move as one object, and the placement would only be altered if the umbrella or the individual rotated independently from one another.

Neither reference frame is incorrect, but they present inconsistent information on the object’s relationship to the world. In other words, position matters.


Orientation in Euclid

All of Euclid’s orientation based code can be found at Euclid/src/main/java/us/ihmc/euclid/orientation/interfaces..

2D Orientation

Changes in orientation around the z axis are known as changes in yaw, taking place in the xy plane with no consideration of height. This is the plane people are most familiar with, as it is the easiest to visualize and is introduced early in math education. A change in yaw does not negate an object’s three dimensional aspects, but indicates that the starting z value and ending z value are consistent. The yaw angle can be measured from any x or y axis within the reference frame.

Under the interfaces folder the classes Orientation2DReadOnly, Orientation2DBasics, and Orientation2D list and describe functions relevant to yaw observation and calculation.

This means that given a vector for comparison, or after a transformation in space, Euclid automatically calculates yaw and when prompted can provide the rotation matrix as well as the inverse of that transformation matrix.

In the Orientation2DReadOnly class, there are several tools to compare the reference placement (other) to the current placement (this) and test geometric and numeric equality. In those functions, epsilon is used as a tolerance variable to ensure that differences in rounding between doubles and floats do not interfere with the result.

3D Orientation

Once a transformation has placement changes in pitch and roll, changing the value of z, the described orientation is handled within the three dimensional classes Orientation3DReadOnly and Orientation3DBasics. Pitch refers to a rotation around the y axis, and roll describes rotations around the x axis.

Euclid uses the yaw-pitch-roll representations to calculate transformation matrices as before. However, the third dimension complicates the process, and the orientations can be represented as quaternions,yaw-pitch-roll packs, rotation vectors, axis angles, and Euler angles. Each method of information processing corresponds to an appropriate transform and inverse transform function so that every approach can be calculated quickly. Keeping these methods separate in the process is critical, as they are not equal, describing the same transformation rather than the same angle or matrix.

The Orientation3D classes also contain several ways to test whether a recorded transformation is two dimensional rather than three dimensional. If the placement was only altered around the z axis, the object can be simplified in 2D for the purposes of finding the transformation functions.

The code is well documented and you are encouraged to explore it. These classes act as a linear algebra calculator and were built to improve efficiency for projects involving movement through 2D and 3D space.

Clone this wiki locally