1 #ifndef INCLUDE_AL_POSE_HPP
2 #define INCLUDE_AL_POSE_HPP
48 #include "al/math/al_Matrix4.hpp"
49 #include "al/math/al_Quat.hpp"
50 #include "al/math/al_Vec.hpp"
88 bool operator==(
const Pose &v)
const {
89 return (mVec == v.
pos()) && (mQuat == v.
quat());
101 const Vec3d &
pos()
const {
return mVec; }
105 const Vec3d &
vec()
const {
return mVec; }
109 const Quatd &
quat()
const {
return mQuat; }
111 double x()
const {
return mVec[0]; }
112 double y()
const {
return mVec[1]; }
113 double z()
const {
return mVec[2]; }
122 void toAED(
const Vec3d &to,
double &azimuth,
double &elevation,
123 double &distance)
const;
239 double qsmooth = 0.9);
255 Pose &target() {
return mTarget; }
256 void target(
const Pose &p) { mTarget.
set(p); }
257 void target(
const Vec3d &p) { mTarget.
pos().
set(p); }
265 void jump(
Vec3d &v) {
269 void jump(
Quatd &q) {
A local coordinate frame.
Pose & setIdentity()
Set to identity transform.
static Pose identity()
Get identity.
Pose & pos(double x, double y, double z)
Set position from individual components.
Mat4d matrix() const
Convert to 4x4 projection space matrix.
Vec3d uu() const
Get up unit vector.
Pose(const Vec3d &pos=Vec3d(0), const Quatd &ori=Quatd::identity())
Vec3d ux() const
Get world space X unit vector.
Pose & pos(const Vec< 3, T > &v)
Set position.
Pose lerp(const Pose &target, double amt) const
Get a linear-interpolated Pose between this and another.
Pose & quat(const Quat< T > &v)
Set quaternion component.
Vec3d uf() const
Get forward unit vector (negative of Z)
void print() const
Print to standard output.
Mat4d directionMatrix() const
Convert to 4x4 direction matrix.
Vec3d & pos()
Get "position" vector.
void faceToward(const Vec3d &p, double amt=1.)
Turn to face a given world-coordinate point.
Vec3d ur() const
Get right unit vector.
Vec3d & vec()
Get vector component.
Pose & operator*=(const Pose &v)
Translate and rotate by argument.
Pose & vec(const Vec< 3, T > &v)
Set vector component.
Pose & set(const Pose &src)
Set state from another Pose.
void toAED(const Vec3d &to, double &azimuth, double &elevation, double &distance) const
Get the azimuth, elevation & distance from this to another point.
void faceToward(const Vec3d &point, const Vec3d &up, double amt=1.)
Pose operator*(const Pose &v) const
Get pose transformed by another pose.
Vec3d uz() const
Get world space Z unit vector.
Quatd & quat()
Get quaternion component (represents orientation)
Pose & set(Pose &src)
Copy all attributes from another Pose.
void unitVectors(Vec< 3, T > &ux, Vec< 3, T > &uy, Vec< 3, T > &uz) const
Get world space unit vectors.
Pose(const Pose &p)
Copy constructor.
void directionVectors(Vec< 3, T > &ur, Vec< 3, T > &uu, Vec< 3, T > &uf) const
Get local right, up, and forward unit vectors.
Vec3d uy() const
Get world space Y unit vector.
Quat & set(const T &w, const T &x, const T &y, const T &z)
Set components.
Quat & setIdentity()
Set to identity.
void slerpTo(const Quat &target, T amt)
In-place spherical interpolation.
void toVectorX(T2 &ax, T2 &ay, T2 &az) const
Get local x unit vector (1,0,0) in absolute coordinates.
static Quat identity()
Returns identity.
void toVectorZ(T2 &ax, T2 &ay, T2 &az) const
Get local z unit vector (0,0,1) in absolute coordinates.
void toVectorY(T2 &ax, T2 &ay, T2 &az) const
Get local y unit vector (0,1,0) in absolute coordinates.
Vec & lerp(const Vec &target, T amt)
Linearly interpolate towards some target.
Vec & set(const Vec< N, T2 > &v)
Set elements from another vector.
Vec< 3, double > Vec3d
double 3-vector
Quat< double > Quatd
Double-precision quaternion.