Rotations

Rotations in NEML are stored as quaternions. In turn, these are stored as length-4 flat arrays.

NEML provides classes implementing general quaternions and unit quaternions, which are representations of 3D rotations (i.e. elements of the special orthogonal group). Currently, the general quaternion class is not used in NEML, it just serves as the base class for the Orientation class, which implements rotations.

As with the Tensors classes, NEML can either manage the memory of a quaternion or use externally managed memory, to allow for efficient block storage of data.

The quaternion classes provide several helpful unary operators, for example methods for inverting and exponentiating quaternions. The implementation also provides binary operators for composing quaternions (equivalent to composing rotations for the Orientation unit quaternion class). It also provides several specialized mathematical operators:

Warning

doxygenfunction: Unable to resolve function “neml::random_orientations” with arguments None in doxygen xml output for project “neml” from directory: ../class-doc/xml. Potential matches:

- std::vector<CrystalOrientation> random_orientations(int n)
- std::vector<CrystalOrientation> random_orientations(int n, unsigned long seed)
Orientation neml::wexp(const Skew &w)

Exponential map of a skew tensor in my convention.

Skew neml::wlog(const Orientation &q)

Inverse exponential map of a quaternion to a skew tensor in my convention.

double neml::distance(const Orientation &q1, const Orientation &q2)

Geodesic distance.

Orientation neml::rotate_to(const Vector &a, const Vector &b)

Arbitrary rotation from a to b.

Orientation neml::rotate_to_family(const Vector &a, const Vector &b, double ang)

Family of rotations from a to b parameterized by an angle.