orientations
— ALE Orientation Classes & Functions¶
-
namespace ale
-
class Orientations¶
- #include <Orientations.h>
Public Functions
-
inline Orientations()¶
Construct a default empty orientation object
-
Orientations(const std::vector<Rotation> &rotations, const std::vector<double> ×, const std::vector<Vec3d> &avs = std::vector<ale::Vec3d>(), const Rotation &constRot = Rotation(1, 0, 0, 0), const std::vector<int> const_frames = std::vector<int>(), const std::vector<int> time_dependent_frames = std::vector<int>())¶
Construct an orientation object give a set of rotations and optionally angular velocities at specific times.
- Parameters:
rotations – The rotations defining the Orientations
times – The times for the rotations and angular velocities
avs – The angular velocity at each time
constRot – An additional constant rotation that is applied after the time dependent rotations
const_frames – The frame ids that constRot rotates through
time_dependent_frames – The frame ids that rotations rotate through
-
inline ~Orientations()¶
Orientations destructor
-
std::vector<double> getTimes() const¶
Get the vector of times
-
std::vector<int> getConstantFrames() const¶
Get the frames that the constant rotation rotates through
-
std::vector<int> getTimeDependentFrames() const¶
Get the frames that the time dependent rotations rotate through
-
Rotation interpolateTimeDep(double time, RotationInterpolation interpType = SLERP) const¶
Get the time dependent component of the interpolated rotation at a specific time.
- Parameters:
time – The time to interpolate at
interpType – The type of interpolation to use
- Returns:
The time dependent rotation at the input time
-
Rotation interpolate(double time, RotationInterpolation interpType = SLERP) const¶
Get the interpolated rotation at a specific time.
- Parameters:
time – The time to interpolate at
interpType – The type of interpolation to use
- Returns:
The full rotation at the input time
-
ale::Vec3d interpolateAV(double time) const¶
Get the interpolated angular velocity at a specific time. Angular velocities are interpolated linearly to match up with the assumptions of SLERP.
- Parameters:
time – The time to interpolate the angular velocity at
- Returns:
The angular velocity at the input time
-
ale::Vec3d rotateVectorAt(double time, const ale::Vec3d &vector, RotationInterpolation interpType = SLERP, bool invert = false) const¶
Rotate a 3d vector at a specific time
- Parameters:
time – The time to rotate the vector at
vector – The input vector to rotate
interpType – The interpolation type to use
invert – If the rotation should be inverted
- Returns:
The rotated 3d vector
-
ale::State rotateStateAt(double time, const ale::State &state, RotationInterpolation interpType = SLERP, bool invert = false) const¶
Rotate a state vector at a specific time
- Parameters:
time – The time to rotate the vector at
state – The input state to rotate
interpType – The interpolation type to use
invert – If the rotation should be inverted
- Returns:
The rotated state
-
Orientations &addConstantRotation(const Rotation &addedConst)¶
Add an additional constant rotation after this. This is equivalent to left multiplication by a constant rotation.
- Parameters:
addedConst – The additional constant rotation to apply after this
- Returns:
A refernce to this after the update
-
Orientations &operator*=(const Orientations &rhs)¶
Multiply this set of orientations by another set of orientations
- Parameters:
rhs – The set of orientations to apply before this set
- Returns:
A refernce to this after the update
-
Orientations &operator*=(const Rotation &rhs)¶
Add an additional constant rotation before this. This is equivalent to right multiplication by a constant rotation.
- Parameters:
rhs – The additional constant rotation to apply before this
- Returns:
A refernce to this after the update
-
Orientations inverse() const¶
Invert the set orientations.
Note that inverting a set of orientations twice does not result in the original orientations. the constant rotation is applied after the time dependent rotation. This means in the inverse, the constant rotation is applied first and then the time dependent rotation. So, the inverted set of orientations is entirely time dependent. Then, the original constant rotations cannot be recovered when inverting again. The set of orientations will still operate the same way, but its internal state will not be the same.
Similarly, the angular velocities will not be the same as we do not assume the angular acceleration to be continuous.
- Returns:
A new set of orientations that are inverted.
Private Members
-
std::vector<ale::Vec3d> m_avs¶
The set of angular velocities. Empty if there are no angular velocities.
-
std::vector<double> m_times¶
The set of times.
-
std::vector<int> m_timeDepFrames¶
The frame IDs that the time dependent rotations rotate through.
-
std::vector<int> m_constFrames¶
The frame IDs that the constant rotation rotates through.
-
inline Orientations()¶
-
class Orientations¶