Orientation

This class represents unit quaternions, i.e. 3D rotations, i.e. members of the special orthogonal group \mathrm{SO}\left(3\right). It provides the apply method capable of applying a rotation to:

  • Vector

  • RankTwo

  • Symmetric

  • Skew

  • RankFour

  • SymSymR4

classes.

The class has static methods that can be used to create rotations from

  • Euler angles

    • Kocks convention

    • Bunge convention

  • Axis/angle pairs

  • Rodrigues vectors

  • Rotation matrices

  • Hopf coordinates

  • Hyperspherical coordinates

Similar methods can be used to convert the quaternion to these representations for output.

class Orientation : public neml::Quaternion

Subclassed by neml::CrystalOrientation

Public Functions

void setRodrigues(const double *const r)

Set from an input Rodrigues vector.

void setMatrix(const double *const M)

Set from an input matrix.

void setAxisAngle(const double *const n, double a, std::string angles = "radians")

Set from an input axis/angle pair.

void setEulerAngles(double a, double b, double c, std::string angles = "radians", std::string convention = "kocks")

Set from inputEuler angles.

void setHopf(double psi, double theta, double phi, std::string angles = "radians")

Set from input Hopf coordinates.

void setHyperspherical(double a1, double a2, double a3, std::string angles = "radians")

Set from input hyperspherical coordinates.

void setVectors(const Vector &x, const Vector &y)

Set from input two vectors.

Orientation()

Default constructor (defaults to identity, manage own memory)

Orientation(double *v)

Raw pointer constructor (don’t manage memory)

Orientation(const std::vector<double> v)

vector<double> constructor (manage own memory)

Orientation(const Quaternion &other)

Copy constructor.

Orientation deepcopy() const

Explicit deepcopy.

void to_euler(double &a, double &b, double &c, std::string angles = "radians", std::string convention = "kocks") const

Convert to Euler angles.

void to_axis_angle(double *const n, double &a, std::string angles = "radians") const

Convert to an axis/angle pair.

void to_matrix(double *const M) const

Convert to a rotation matrix.

RankTwo to_tensor() const

Convert to a rank 2 tensor.

void to_rodrigues(double *const v) const

Convert to a Rodrigues vector.

void to_hopf(double &alpha, double &beta, double &gamma, std::string angles = "radians") const

Convert to Hopf coordinates.

void to_hyperspherical(double &a1, double &a2, double &a3, std::string angles = "radians") const

Convert to hyperspherical coordinates.

Orientation opposite() const

Opposite.

Orientation operator-() const

C++ operator opposite.

Orientation conj() const

Conjugation.

Orientation flip() const

Opposite scalar.

Orientation inverse() const

Inversion.

Orientation &operator*=(const Orientation &rhs)

Orientation multiplication.

Orientation &operator/=(const Orientation &rhs)

Orientation division.

Orientation pow(double w) const

Power.

Vector apply(const Vector &a) const

Rotate a Vector.

RankTwo apply(const RankTwo &a) const

Rotate a Rank2.

Symmetric apply(const Symmetric &a) const

Rotate a Symmetric tensor.

Skew apply(const Skew &a) const

Rotate a Skew tensor.

RankFour apply(const RankFour &a) const

Rotate a RankFour tensor.

SymSymR4 apply(const SymSymR4 &a) const

Rotate a SymSymR4 rank four tensor.

double distance(const Orientation &other) const

Geodesic distance.

Public Static Functions

static Orientation createRodrigues(const double *const r)

Create from a Rodrigues vector.

static Orientation createMatrix(const double *const M)

Create from a rotation matrix.

static Orientation createAxisAngle(const double *const n, double a, std::string angles = "radians")

Create from an axis-angle representation.

static Orientation createEulerAngles(double a, double b, double c, std::string angles = "radians", std::string convention = "kocks")

Create from various Euler angles.

static Orientation createHopf(double psi, double theta, double phi, std::string angles = "radians")

Create from the Hopf coordinates.

static Orientation createHyperspherical(double a1, double a2, double a3, std::string angles = "radians")

Create from hyperspherical coordinates.

static Orientation createVectors(const Vector &x, const Vector &y)

Create from two vectors.