ReferenceFrame API Reference#
Table of Contents
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.
Attributes#
- ReferenceFrame.order#
Read-only attribute of the Order object used to instantiate the ReferenceFrame.
- Type:
- ReferenceFrame.matrix#
Read-only attribute of the internal matrix used to compute vector rotations.
- Type:
- ReferenceFrame.angles#
The
Angles
object used to instantate theRefernceFrame
. Setting this value will cause the internal matrix to be recomputed, however changing a single angle attribute via the angles attribute cannot force the matrix to change. This will invalidate the rotation methods theReferenceFrame
class provides.>>> 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 remains unchanged >>> ref.matrix Matrix([0.411982, 0.0587266, 0.909297] [-0.681243, -0.642873, 0.350175] [0.605127, -0.763718, -0.224845])
To overcome this, the class also provides sub-angle attributes (see below) that will indirectly change the desired angle and force the matrix to be recomputed.
- Type:
- ReferenceFrame.alpha#
Indirectly get or set the alpha angle of the
angles
attribute and force the internal rotation matrix to be recomputed.- Type:
float
- ReferenceFrame.beta#
Indirectly get or set the beta angle of the
angles
attribute and force the internal rotation matrix to be recomputed.- Type:
float
Instance Methods#
- ReferenceFrame.rotateTo(vector)#
Rotates vector to this reference frame.
- ReferenceFrame.rotateFrom(vector)#
Rotates vector from this reference frame.
- 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:
- 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: