ReferenceFrame API Reference#

The ReferenceFrame object allows the user to represent reference frames without needing to keep track and correctly handle a rotation matrix and offset vectors. The ReferenceFrame class holds this information and handles rotating to and from the reference frame for you.

class pyevspace.ReferenceFrame(order, angles[, *, offset])#

A class that holds all information for a reference frame, and methods to handling rotating between it and other frames.

Parameters:
  • order (Order) – the Euler order for the rotation of the reference frame

  • angles (Angles) – the associated angles for the Euler rotation of the reference frame

  • offset (Vector) – optional vector when a reference frame’s origin is offset

Attributes#

ReferenceFrame.order#

Read-only attribute of the Order object used to instantiate the ReferenceFrame.

Type:

Order

ReferenceFrame.matrix#

Read-only attribute of the internal matrix used to compute vector rotations.

Type:

Matrix

ReferenceFrame.angles#

The Angles object used to instantate the RefernceFrame. Setting this value or any of its angle attributes will cause the internal matrix to be recomputed.

>>> ref = ReferenceFrame(XYZ, Angles(1, 2, 3))
>>> ref.matrix
Matrix([0.411982, 0.0587266, 0.909297]
    [-0.681243, -0.642873, 0.350175]
    [0.605127, -0.763718, -0.224845])
>>> ref.angles.alpha = 2
>>> # ref.matrix updated
>>> ref.matrix
Matrix([0.411982, 0.0587266, 0.909297]
    [-0.877274, 0.295301, 0.378401]
    [-0.246294, -0.953598, 0.173178])
Type:

Angles

ReferenceFrame.offset#

Get or set an offset vector for the reference frame and recompute the internal rotation matrix.

Type:

Vector

Instance Methods#

ReferenceFrame.rotateTo(vector)#

Rotates vector to this reference frame.

Parameters:

vector (Vector) – vector to be rotated

Raises:

TypeError – if vector is not a Vector type

Returns:

the rotated vector

Return type:

Vector

ReferenceFrame.rotateFrom(vector)#

Rotates vector from this reference frame.

Parameters:

vector (Vector) – vector to be rotated

Raises:

TypeError – if vector is not a Vector type

Returns:

the rotated vector

Return type:

Vector

ReferenceFrame.rotateToFrame(frame, vector)#

Rotates vector from this reference frame to another reference frame.

Parameters:
  • frame (ReferenceFrame) – reference frame to rotate vector to

  • vector (Vector) – vector to be rotated

Returns:

the rotated vector

Return type:

Vector

ReferenceFrame.rotateFromFrame(frame, vector)#

Rotates vector to this reference frame from another reference frame.

Parameters:
  • frame (ReferenceFrame) – reference frame to rotate vector from

  • vector (Vector) – vector to be rotated

Returns:

the rotated vector

Return type:

Vector