43 #ifndef AA_TF_SPATIAL_HPP
44 #define AA_TF_SPATIAL_HPP
120 memcpy(V.
data, a_x, 3 *
sizeof(V.
data[0]));
255 memcpy(
y.data,
x, 4 *
sizeof(
y.data[0]));
297 double x[4] = {a[0], a[1], a[2], angle};
399 RotMat(
double r11,
double r12,
double r13,
double r21,
double r22,
400 double r23,
double r31,
double r32,
double r33)
409 double r21,
double r22,
double r23,
410 double r31,
double r32,
double r33)
443 memcpy(y.
data, x, 9 *
sizeof(y.
data[0]));
578 double n = sqrt(x * x + y * y + z * z);
579 double a[4] = {x / n, y / n, z / n, theta};
589 memcpy(y.data, x, 4 *
sizeof(y.data[0]));
749 double w_real,
double x_dual,
double y_dual,
750 double z_dual,
double w_dual)
764 memcpy(S.data, s, 8 *
sizeof(s[0]));
939 double t_x,
double t_y,
double t_z)
954 memcpy(qv.
r.
data, a_r, 4 *
sizeof(qv.
r.
data[0]));
955 memcpy(qv.
v.
data, a_v, 3 *
sizeof(qv.
v.
data[0]));
1098 memcpy(T.
data, t, 12 *
sizeof(T.
data[0]));
AA_API void aa_tf_duqu_conj(const double d[AA_RESTRICT 8], double dconj[AA_RESTRICT 8])
Dual quaternion conjugate.
static const double aa_tf_ident[12]
Identity transformation matrix array.
AA_API void aa_tf_quat2axang(const double q[AA_RESTRICT 4], double axang[AA_RESTRICT 4])
Quaternion to axis-angle.
AA_API void aa_tf_xangle2rotmat(double theta_x, double R[AA_RESTRICT 9])
Angle about x axis.
AA_API void aa_tf_rotmat_rot(const double R[AA_RESTRICT 9], const double p0[AA_RESTRICT 3], double p1[AA_RESTRICT 3])
Rotate a point using a rotation matrix.
AA_API void aa_tf_quat2rotmat(const double quat[AA_RESTRICT 4], double rotmat[AA_RESTRICT 9])
convert quaternion to rotation matrix
AA_API void aa_tf_zxyz2duqu(double theta, double x, double y, double z, double d[AA_RESTRICT 8])
Convert z angle and translation to dual quaternion.
AA_API void aa_tf_qrot(const double q[AA_RESTRICT 4], const double v[AA_RESTRICT 3], double p[AA_RESTRICT 3])
Quaternion point rotation.
AA_API void aa_tf_duqu2qv(const double d[AA_RESTRICT 8], double q[AA_RESTRICT 4], double v[AA_RESTRICT 3])
Convert dual quaternion to orientation unit quaternion and translation vector.
AA_API void aa_tf_yangle2rotmat(double theta_y, double R[AA_RESTRICT 9])
Angle about y axis.
AA_API void aa_tf_duqu_trans(const double d[AA_RESTRICT 8], double v[AA_RESTRICT 3])
Extract dual quaternion translation vector.
AA_API void aa_tf_qutr_tf(const double E[AA_RESTRICT 7], const double p0[AA_RESTRICT 3], double p1[AA_RESTRICT 3])
Transform a point,.
AA_API void aa_tf_duqu2tfmat(const double d[AA_RESTRICT 8], double T[AA_RESTRICT 12])
Convert dual quaternion to transformation matrix.
AA_API void aa_tf_qutr_conj(const double a[7], double c[7])
quaternion-translation conjugate
AA_API void aa_tf_qv_chain(const double q0[AA_RESTRICT 4], const double v0[AA_RESTRICT 3], const double q1[AA_RESTRICT 4], const double v1[AA_RESTRICT 3], double q[AA_RESTRICT 4], double v[AA_RESTRICT 3])
chain two transforms
AA_API void aa_tf_qmul(const double a[AA_RESTRICT 4], const double b[AA_RESTRICT 4], double c[AA_RESTRICT 4])
Quaternion multiplication.
AA_API void aa_tf_rotmat2axang(const double R[AA_RESTRICT 9], double ra[AA_RESTRICT 4])
convert rotation matrix to axis angle
AA_API void aa_tf_axang2quat(const double axang[AA_RESTRICT 4], double q[AA_RESTRICT 4])
axis-angle to quaternion.
AA_API void aa_tf_qv2duqu(const double q[AA_RESTRICT 4], const double v[AA_RESTRICT 3], double d[AA_RESTRICT 8])
Convert orientation unit quaternion and translation vector to dual quaternion.
AA_API void aa_tf_duqu_mul(const double d1[AA_RESTRICT 8], const double d2[AA_RESTRICT 8], double d3[AA_RESTRICT 8])
Dual quaternion multiplication.
AA_API void aa_tf_duqu_vel2diff(const double d[AA_RESTRICT 8], const double dx[AA_RESTRICT 6], double dd[AA_RESTRICT 8])
Dual quaternion derivative from velocity.
AA_API void aa_tf_zangle2rotmat(double theta_z, double R[AA_RESTRICT 9])
Angle about z axis.
AA_API void aa_tf_xangle2quat(double theta_x, double q[AA_RESTRICT 4])
Unit quaternion for angle about x axis.
AA_API void aa_tf_9mul(const double R0[AA_RESTRICT 9], const double R1[AA_RESTRICT 9], double R[AA_RESTRICT 9])
Multiply two rotation matrices.
AA_API void aa_tf_12chain(const double T1[AA_RESTRICT 12], const double T2[AA_RESTRICT 12], double T[AA_RESTRICT 12])
chain two transforms
AA_API void aa_tf_rotmat2quat(const double rotmat[AA_RESTRICT 9], double quat[AA_RESTRICT 4])
convert rotation matrix to quaternion
AA_API void aa_tf_axang2rotmat(const double ra[AA_RESTRICT 4], double R[AA_RESTRICT 9])
convert axis angle to rotation matrix
AA_API void aa_tf_rotvec2rotmat(const double rv[AA_RESTRICT 3], double R[AA_RESTRICT 9])
convert rotatoin vector to rotation matrix
AA_API void aa_tf_yxyz2duqu(double theta, double x, double y, double z, double d[AA_RESTRICT 8])
Convert y angle and translation to dual quaternion.
AA_API void aa_tf_xyz2duqu(double x, double y, double z, double d[AA_RESTRICT 8])
Pure translation dual quaternion.
AA_API void aa_tf_rotvec2quat(const double rotvec[AA_RESTRICT 3], double q[AA_RESTRICT 4])
covert rotation vector to quaternion
AA_API void aa_tf_zangle2quat(double theta_z, double q[AA_RESTRICT 4])
Unit quaternion for angle about z axis.
AA_API void aa_tf_yangle2quat(double theta_y, double q[AA_RESTRICT 4])
Unit quaternion for angle about y axis.
AA_API void aa_tf_tfmat2duqu(const double T[AA_RESTRICT 12], double d[AA_RESTRICT 8])
Convert transformation matrix to dual quaternion.
AA_API void aa_tf_xxyz2duqu(double theta, double x, double y, double z, double d[AA_RESTRICT 8])
Convert x angle and translation to dual quaternion.
AA_API void aa_tf_rotvec2axang(const double rotvec[AA_RESTRICT 3], double axang[AA_RESTRICT 4])
convert rotation vector to axis-angle
AA_API void aa_tf_tfmat_tf(const double T[AA_RESTRICT 12], const double p0[AA_RESTRICT 3], double p1[AA_RESTRICT 3])
Transform a point using a transformation matrix.
AA_API void aa_tf_qv2tfmat(const double q[AA_RESTRICT 4], const double v[AA_RESTRICT 3], double T[AA_RESTRICT 12])
Convert orientation unit quaternion and translation vector to transformation matrix.
Memory layout for axis-Angle rotation in x,y,z,angle order.
Memory layout for a dual quaternion.
Memory layout for a quaternion, x,y,z,w order.
Memory layout for a Transformation as rotation quaternion and translation vector.
aa_tf_vec3_t v
translation vector
aa_tf_quat_t r
rotation unit quaternion
Memory layout for a rotation matrix.
Memory layout for a transformation matrix.
double data[12]
data array
aa_tf_vec3_t v
the origin vector part
Memory layout for a vector of length 3.
static aa_tf_axang from_rotmat(const double x[9])
Create an axis angle from a rotation matrix.
static aa_tf_axang from_rotvec(const double x[3])
Create an axis angle from a rotation vector.
AxisAngle(const aa_tf_axang &p)
Construct an axis-angle from another axis-angle.
AxisAngle(double x, double y, double z, double theta)
Construct an axis-angle from individual components.
AxisAngle(const aa_tf_rotmat *p)
Construct an axis-angle from a rotation matrix.
AxisAngle()
Construct an idenity axis-angle.
static aa_tf_axang from_axang(double x, double y, double z, double theta)
Create an axis angle from individual components.
AxisAngle(const aa_tf_quat *p)
Construct an axis-angle from a unit quaternion.
AxisAngle(const double *_axis, double _angle)
Construct an axis-angle from an axis array and an angle.
static aa_tf_axang from_quat(const double x[4])
Create an axis angle from a unit quaternion.
AxisAngle(const aa_tf_quat &p)
Construct an axis-angle from a unit quaternion.
AxisAngle(const aa_tf_axang *p)
Construct an axis-angle from another axis-angle.
AxisAngle(const aa_tf_rotmat &p)
Construct an axis-angle from a rotation matrix.
static aa_tf_axang from_axang(const double axis[3], double angle)
Create an axis angle from an axis array and an angle.
static aa_tf_axang from_axang(const double x[4])
Create an axis angle from an axis angle array.
A dual quaternion object.
DualQuat(const struct aa_tf_tfmat *T)
Construct from a transformation matrix.
static aa_tf_duqu from_qv(const double q[4], const double v[3])
Create a dual quaternion from a rotation quaternion and a translation vector.
DualQuat(const struct aa_tf_tfmat &T)
Construct from a transformation matrix.
static aa_tf_duqu from_yxyz(double theta, double x, double y, double z)
Create a dual quaternion an Y axis rotation and translation components.
DualQuat(const struct aa_tf_duqu *S)
Construct from another dual quaternion.
DualQuat(const struct aa_tf_vec3 &v)
Construct from an identity rotation and a translation vector.
DualQuat(const struct aa_tf_duqu &S)
Construct from another dual quaternion.
DualQuat(const ZAngle &r, const struct aa_tf_vec3 &v)
Construct from a rotation about Z and a translation vector.
static aa_tf_duqu from_dx(double *s, double *dx)
Create a dual quaternion derivative from a dual quaternion and the spatial velocity.
static aa_tf_duqu from_duqu(const double s[8])
Create a dual quaternion from another dual quaternion.
DualQuat(const struct aa_tf_quat &r, const struct aa_tf_vec3 &v)
Construct from a quaternion-vector.
static aa_tf_duqu from_tfmat(const double T[12])
Create a dual quaternion from a transformation matrix.
DualQuat(const struct aa_tf_qv *S)
Construct from a quaternion-vector.
static aa_tf_duqu from_xyz(double x, double y, double z)
Create a dual quaternion from and identity rotation and translation components.
DualQuat()
Construct an identity dual quaternion.
static aa_tf_duqu from_xyzw(double x_real, double y_real, double z_real, double w_real, double x_dual, double y_dual, double z_dual, double w_dual)
Create a dual quaternion from components.
DualQuat(const double *S)
Construct from another dual quaternion.
aa_tf_vec3 translation()
Return the translation part of a unit dual quaternion.
static aa_tf_duqu from_xxyz(double theta, double x, double y, double z)
Create a dual quaternion an X axis rotation and translation components.
DualQuat(const YAngle &r, const struct aa_tf_vec3 &v)
Construct from a rotation about Y and a translation vector.
static aa_tf_duqu from_zxyz(double theta, double x, double y, double z)
Create a dual quaternion an Z axis rotation and translation components.
DualQuat(const XAngle &r, const struct aa_tf_vec3 &v)
Construct from a rotation about X and a translation vector.
DualQuat(const struct aa_tf_qv &S)
Construct from a quaternion-vector.
DualQuat conj()
Return the conjugate of this.
DualQuat(const struct aa_tf_quat *r, const struct aa_tf_vec3 *v)
Construct from a quaternion-vector.
DualQuat(const aa_tf_axang &r, const struct aa_tf_vec3 &v)
Construct from an axis-angle rotation and a translation vector.
A rotation quaternion and translation vector object.
QuatTran(const struct aa_tf_duqu *S)
Construct from a dual quaternion.
QuatTran(const struct YAngle &_r, const struct aa_tf_vec3 &_v)
Construct from a principal angle and a vector.
QuatTran(const struct aa_tf_quat &_r, const struct aa_tf_vec3 &_v)
Construct from another quaternion-translation.
static aa_tf_qv from_duqu(const double s[8])
Create a quaternion-translation from a dual quaternion.
void transform(const aa_tf_vec3 *a, aa_tf_vec3 *b) const
Transform a vector.
static aa_tf_qv from_tfmat(const double t[12])
Create a quaternion-translation from a transformation matrix.
void transform(const double a[3], double b[3]) const
Transform a vector.
static aa_tf_qv from_qv(const double e[7])
Create a quaternion-translation from a rotation quaternion and a translation vector.
QuatTran(const struct XAngle &_r, const struct aa_tf_vec3 &_v)
Construct from a principal angle and a vector.
static aa_tf_qv from_xyzw(double q_x, double q_y, double q_z, double q_w, double t_x, double t_y, double t_z)
Create a quaternion-translation from components.
QuatTran(const struct aa_tf_tfmat &T)
Construct from a transformation matrix.
QuatTran(const struct aa_tf_qv &S)
Construct from another quaternion-translation.
static aa_tf_qv from_qv(const double a_r[4], const double a_v[3])
Create a quaternion-translation from a rotation quaternion and a translation vector.
QuatTran(const struct aa_tf_qv *S)
Construct from another quaternion-translation.
aa_tf_qv conj()
Return the conjugate (inverse).
QuatTran(const struct ZAngle &_r, const struct aa_tf_vec3 &_v)
Construct from a principal angle and a vector.
aa_tf_vec3 transform(const aa_tf_vec3 &a) const
Transform a vector.
QuatTran()
Construct an idenity object.
QuatTran(const struct aa_tf_duqu &S)
Construct from a dual quaternion.
QuatTran(const struct aa_tf_quat *_r, const struct aa_tf_vec3 *_v)
Construct from another quaternion-translation.
QuatTran(const struct aa_tf_tfmat *T)
Construct from a transformation matrix.
Quat(const aa_tf_rotmat *p)
Construct from a rotation matrix.
static aa_tf_quat from_zangle(const double v)
Create a quaternion object rotation about z.
static aa_tf_quat from_rotmat(const double x[9])
Create a quaternion object a rotation matrix.
Quat(const XAngle &p)
Construct from a rotation about the x axis.
static aa_tf_quat from_quat(const double x[4])
Create a quaternion object from a quaternion array.
Quat(const aa_tf_quat *p)
Construct from another quaternion.
Quat(const aa_tf_axang *p)
Construct from an axix angle rotation.
Quat(const YAngle &p)
Construct from a rotation about the Y axis.
Quat(const aa_tf_axang &p)
Construct from an axix angle rotation.
Quat(const aa_tf_rotmat &p)
Construct from a rotation matrix.
aa_tf_vec3 rotate(const aa_tf_vec3 &p) const
Rotate a vector by this quaternion.
Quat()
Construct an identity quaternion.
static aa_tf_quat from_rotvec(const double x[3])
Create a quaternion object a rotation vector.
Quat(const aa_tf_quat &p)
Construct from another quaternion.
static aa_tf_quat from_axang(const double x[4])
Create a quaternion object an axis-angle.
Quat(const ZAngle &p)
Construct from a rotation about the Z axis.
static aa_tf_quat from_xangle(const double v)
Create a quaternion object rotation about x.
static aa_tf_quat from_axang(const double a[3], double angle)
Create a quaternion object an axis-angle.
static aa_tf_quat from_yangle(const double v)
Create a quaternion object rotation about y.
static aa_tf_quat from_xyzw(double x, double y, double z, double w)
Create a quaternion object from components.
void rotate(const aa_tf_vec3 *p, aa_tf_vec3 *q) const
Rotate a vector by this quaternion.
A rotation matrix object.
RotMat(const aa_tf_axang *p)
Construct a rotation matrix from an axis-angle.
RotMat()
Construct an identity rotation matrix.
static aa_tf_rotmat from_quat(const double x[4])
Create a rotation matrix from a unit quaternion.
RotMat(const XAngle &p)
Construct a rotation matrix from a rotation about X.
static aa_tf_rotmat from_rotvec(const double x[3])
Create a rotation matrix from a rotation vector.
RotMat(const aa_tf_rotmat *p)
Construct a rotation matrix from another rotation matrix.
static aa_tf_rotmat from_axang(const double x[4])
Create a rotation matrix from an axis-angle.
static aa_tf_rotmat from_xangle(const double v)
Create a rotation matrix from a rotation about X.
RotMat(const aa_tf_rotmat &p)
Construct a rotation matrix from another rotation matrix.
RotMat(const YAngle &p)
Construct a rotation matrix from a rotation about Y.
static aa_tf_rotmat from_zangle(const double v)
Create a rotation matrix from a rotation about Z.
RotMat(const aa_tf_quat &p)
Construct a rotation matrix from a unit quaternion.
static aa_tf_rotmat from_rotmat(double r11, double r12, double r13, double r21, double r22, double r23, double r31, double r32, double r33)
Create a rotation matrix from individual components.
static aa_tf_rotmat from_rotmat(const double x[9])
Create a rotation matrix object from a rotation matrix array.
RotMat(const ZAngle &p)
Construct a rotation matrix from a rotation about Z.
RotMat(double r11, double r12, double r13, double r21, double r22, double r23, double r31, double r32, double r33)
Construct a rotation matrix from individual components.
RotMat(const aa_tf_axang &p)
Construct a rotation matrix from an axis-angle.
static aa_tf_rotmat from_yangle(const double v)
Create a rotation matrix from a rotation about Y.
RotMat(const aa_tf_quat *p)
Construct a rotation matrix from a unit quaternion.
A transformation matrix object.
aa_tf_vec3 transform(const aa_tf_vec3 &a) const
Transform a vector.
void transform(const aa_tf_vec3 *a, aa_tf_vec3 *b) const
Transform a vector.
static aa_tf_tfmat from_tfmat(const double t[12])
Construct a transformation matrix from another transformation matrix.
static aa_tf_tfmat from_qv(const double q[4], const double v[3])
Construct a transformation matrix from a rotation quaternion and translation vector.
TfMat(const struct aa_tf_duqu *S)
Construct a transformation matrix from a dual quaternion.
static aa_tf_tfmat from_duqu(const double s[8])
Construct a transformation matrix from a dual quaternion.
TfMat(const struct aa_tf_qv *S)
Construct a transformation matrix from a quaternion-translation.
TfMat(const struct aa_tf_quat *_r, const struct aa_tf_vec3 *_v)
Construct a transformation matrix from a quaternion-translation.
TfMat(const struct aa_tf_qv &S)
Construct a transformation matrix from a quaternion-translation.
void transform(const double a[3], double b[3]) const
Transform a vector.
TfMat(const struct aa_tf_tfmat *T)
Construct a transformation matrix from another transformation matrix.
TfMat()
Construct an identity transformation matrix.
TfMat(const struct aa_tf_duqu &S)
Construct a transformation matrix from a dual quaternion.
TfMat(const struct aa_tf_tfmat &T)
Construct a transformation matrix from another transformation matrix.
TfMat(const struct aa_tf_quat &_r, const struct aa_tf_vec3 &_v)
Construct a transformation matrix from a quaternion-translation.
Vec3(const double *_xyz)
Construct from array.
Vec3(const struct aa_tf_duqu *S)
Extract the translation part of a unit dual quaternion.
Vec3(const struct aa_tf_tfmat &T)
Extract the translation part of a transformation matrix.
Vec3(const struct aa_tf_tfmat *T)
Extract the translation part of a transformation matrix.
Vec3(const struct aa_tf_duqu &S)
Extract the translation part of a unit dual quaternion.
Vec3(double _x, double _y, double _z)
Construct from individual components.
static aa_tf_vec3 from_tfmat(const double T[12])
Create a Vec3 from translation part of transformation matrix.
static aa_tf_vec3 from_duqu(const double S[8])
Create a Vec3 from translation part of unit dual quation.
static aa_tf_vec3 from_vec3(const double a_x[3])
Create a Vec3 from array.
Vec3(const aa_tf_vec3 &src)
Construct from vec3.
static aa_tf_vec3 from_xyz(double x, double y, double z)
Create a Vec3 from components.
A rotation about the X axis.
XAngle(double v)
Construct with the given angle.
double value
The angle value in radians.
A rotation about the Y axis.
double value
The angle value in radians.
YAngle(double v)
Construct with the given angle.
A rotation about the Z axis.
double value
The angle value in radians.
ZAngle(double v)
Construct with the given angle.