1#ifndef __JBXL_CPP_QUATERNION_H_
2#define __JBXL_CPP_QUATERNION_H_
56 Quaternion(T S, T X, T Y, T Z, T N=(T)0.0, T C=(T)1.0) { set(S, X, Y, Z, N, C);}
60 T
norm(
void) { n = (T)sqrt(s*s+x*x+y*y+z*z);
return n;}
63 void set(T S, T X, T Y, T Z, T N=(T)0.0, T C=(T)1.0);
64 void init(T C=(T)1.0) { s=n=(T)1.0; x=y=z=(T)0.0; c=C;}
106{
return (q1.
s==q2.
s && q1.
x==q2.
x && q1.
y==q2.
y && q1.
z==q2.
z); }
110{
return (q1.
s!=q2.
s || q1.
x!=q2.
x || q1.
y!=q2.
y || q1.
z!=q2.
z); }
149 if (a.
c<(T)0.0 || b.
c<(T)0.0) quat.
init(-(T)1.0);
160 if (q.
c<(T)0.0 || v.
c<(T)0.0) quat.
init(-(T)1.0);
171 if (q.
c<(T)0.0 || v.
c<(T)0.0) quat.
init(-(T)1.0);
232#define Quaternion2RotMatrix(q) (q).getRotMatrix()
253#define VectorRotate(v, q) VectorRotation((v),(q))
254#define VectorInvRotate(v, q) VectorInvRotation((v), (q))
283 n = (T)sqrt(s*s + x*x + y*y + z*z);
290 T nrm = (T)sqrt(s*s + x*x + y*y + z*z);
315 if (e>(T)
PI) e = e - (T)
PI2;
316 else if (e<-(T)
PI) e = (T)
PI2 + e;
341 Vector<T> ex((T)1.0, (T)0.0, (T)0.0, (T)1.0);
342 Vector<T> ey((T)0.0, (T)1.0, (T)0.0, (T)1.0);
343 Vector<T> ez((T)0.0, (T)0.0, (T)1.0, (T)1.0);
351 if (s<(T)0.0) (*this) = - (*this);
358 Vector<T> ex((T)1.0, (T)0.0, (T)0.0, (T)1.0);
359 Vector<T> ey((T)0.0, (T)1.0, (T)0.0, (T)1.0);
360 Vector<T> ez((T)0.0, (T)0.0, (T)1.0, (T)1.0);
368 if (s<(T)0.0) (*this) = - (*this);
375 Vector<T> ex((T)1.0, (T)0.0, (T)0.0, (T)1.0);
376 Vector<T> ey((T)0.0, (T)1.0, (T)0.0, (T)1.0);
377 Vector<T> ez((T)0.0, (T)0.0, (T)1.0, (T)1.0);
385 if (s<(T)0.0) (*this) = - (*this);
392 Vector<T> ex((T)1.0, (T)0.0, (T)0.0, (T)1.0);
393 Vector<T> ey((T)0.0, (T)1.0, (T)0.0, (T)1.0);
394 Vector<T> ez((T)0.0, (T)0.0, (T)1.0, (T)1.0);
402 if (s<(T)0.0) (*this) = - (*this);
409 Vector<T> ex((T)1.0, (T)0.0, (T)0.0, (T)1.0);
410 Vector<T> ey((T)0.0, (T)1.0, (T)0.0, (T)1.0);
411 Vector<T> ez((T)0.0, (T)0.0, (T)1.0, (T)1.0);
419 if (s<(T)0.0) (*this) = - (*this);
426 Vector<T> ex((T)1.0, (T)0.0, (T)0.0, (T)1.0);
427 Vector<T> ey((T)0.0, (T)1.0, (T)0.0, (T)1.0);
428 Vector<T> ez((T)0.0, (T)0.0, (T)1.0, (T)1.0);
436 if (s<(T)0.0) (*this) = - (*this);
449 if (n!=(T)1.0) normalize();
451 mtx.
element(1, 1) = (T)1.0 - (T)2.0*y*y - (T)2.0*z*z;
452 mtx.
element(1, 2) = (T)2.0*x*y - (T)2.0*s*z;
453 mtx.
element(1, 3) = (T)2.0*x*z + (T)2.0*s*y;
454 mtx.
element(2, 1) = (T)2.0*x*y + (T)2.0*s*z;
455 mtx.
element(2, 2) = (T)1.0 - (T)2.0*x*x - (T)2.0*z*z;
456 mtx.
element(2, 3) = (T)2.0*y*z - (T)2.0*s*x;
457 mtx.
element(3, 1) = (T)2.0*x*z - (T)2.0*s*y;
458 mtx.
element(3, 2) = (T)2.0*y*z + (T)2.0*s*x;
459 mtx.
element(3, 3) = (T)1.0 - (T)2.0*x*x - (T)2.0*y*y;
468 if (c<(T)0.0)
return v;
482 if (c<(T)0.0)
return v;
516 mtx.
element(1, 2) = sinx*siny*cosz - cosx*sinz;
517 mtx.
element(1, 3) = cosx*siny*cosz + sinx*sinz;
519 mtx.
element(2, 2) = sinx*siny*sinz + cosx*cosz;
520 mtx.
element(2, 3) = cosx*siny*sinz - sinx*cosz;
541 mtx.
element(1, 2) = -cosy*sinz;
543 mtx.
element(2, 1) = sinx*siny*cosz + cosx*sinz;
544 mtx.
element(2, 2) = -sinx*siny*sinz + cosx*cosz;
545 mtx.
element(2, 3) = -sinx*cosy;
546 mtx.
element(3, 1) = -cosx*siny*cosz + sinx*sinz;
547 mtx.
element(3, 2) = cosx*siny*sinz + sinx*cosz;
566 mtx.
element(1, 2) = -cosx*cosy*sinz + sinx*siny;
567 mtx.
element(1, 3) = sinx*cosy*sinz + cosx*siny;
570 mtx.
element(2, 3) = -sinx*cosz;
571 mtx.
element(3, 1) = -siny*cosz;
572 mtx.
element(3, 2) = cosx*siny*sinz + sinx*cosy;
573 mtx.
element(3, 3) = -sinx*siny*sinz + cosx*cosy;
593 mtx.
element(2, 1) = cosx*cosy*sinz + sinx*siny;
595 mtx.
element(2, 3) = cosx*siny*sinz - sinx*cosy;
596 mtx.
element(3, 1) = sinx*cosy*sinz - cosx*siny;
598 mtx.
element(3, 3) = sinx*siny*sinz + cosx*cosy;
615 mtx.
element(1, 1) = sinx*siny*sinz + cosy*cosz;
616 mtx.
element(1, 2) = sinx*siny*cosz - cosy*sinz;
621 mtx.
element(3, 1) = sinx*cosy*sinz - siny*cosz;
622 mtx.
element(3, 2) = sinx*cosy*cosz + siny*sinz;
640 mtx.
element(1, 1) = -sinx*siny*sinz + cosy*cosz;
641 mtx.
element(1, 2) = -cosx*sinz;
642 mtx.
element(1, 3) = sinx*cosy*sinz + siny*cosz;
643 mtx.
element(2, 1) = sinx*siny*cosz + cosy*sinz;
645 mtx.
element(2, 3) = -sinx*cosy*cosz + siny*sinz;
646 mtx.
element(3, 1) = -cosx*siny;
658 Vector<T> eul((T)0.0, (T)0.0, (T)0.0, (T)0.0, -(T)1.0);
662 if (m31<-(T)1.0 || m31>(T)1.0)
return eul;
669 arctang = (T)atan2(-m12, -m13);
670 ev[0].
x = arctang - ev[0].
z;
671 ev[1].
x = arctang - ev[1].
z;
677 arctang = (T)atan2(m12, m13);
678 ev[0].
x = arctang + ev[0].
z;
679 ev[1].
x = arctang + ev[1].
z;
684 ev[0].
y = -(T)asin(m31);
685 if (ev[0].y>=(T)0.0) ev[1].y = (T)
PI - ev[0].
y;
686 else ev[1].
y = - (T)
PI - ev[0].y;
688 T cy1 = (T)cos(ev[0].y);
689 T cy2 = (T)cos(ev[1].y);
692 ev[0].
x = (T)atan2(m32/cy1, m33/cy1);
693 ev[0].
z = (T)atan2(m21/cy1, m11/cy1);
695 if (ev[0].x>=(T)0.0) ev[1].x = ev[0].x - (T)
PI;
696 else ev[1].
x = ev[0].
x + (T)
PI;
697 if (ev[0].z>=(T)0.0) ev[1].z = ev[0].z - (T)
PI;
698 else ev[1].
z = ev[0].
z + (T)
PI;
704 vct[0].set(ev[0].x, ev[0].y, ev[0].z);
705 vct[1].set(ev[1].x, ev[1].y, ev[1].z);
707 eul.
set(ev[0].x, ev[0].y, ev[0].z);
715 Vector<T> eul((T)0.0, (T)0.0, (T)0.0, (T)0.0, -(T)1.0);
719 if (m13<-(T)1.0 || m13>(T)1.0)
return eul;
726 arctang = (T)atan2(m21, -m31);
727 ev[0].
x = (T)arctang - ev[0].z;
728 ev[1].
x = (T)arctang - ev[1].z;
734 arctang = (T)atan2(-m21, m31);
735 ev[0].
x = (T)arctang + ev[0].z;
736 ev[1].
x = (T)arctang + ev[1].z;
741 ev[0].
y = (T)asin(m13);
742 if (ev[0].y>=0.0) ev[1].
y = (T)
PI - ev[0].y;
743 else ev[1].
y = -(T)
PI - ev[0].y;
745 T cy1 = (T)cos(ev[0].y);
746 T cy2 = (T)cos(ev[1].y);
749 ev[0].
x = atan2(-m23/cy1, m33/cy1);
750 ev[0].
z = atan2(-m12/cy1, m11/cy1);
752 if (ev[0].x>=(T)0.0) ev[1].
x = ev[0].
x - (T)
PI;
753 else ev[1].
x = ev[0].
x + (T)
PI;
754 if (ev[0].z>=(T)0.0) ev[1].z = ev[0].z - (T)
PI;
755 else ev[1].
z = ev[0].
z + (T)
PI;
761 vct[0].set(ev[0].z, ev[0].y, ev[0].x);
762 vct[1].set(ev[1].z, ev[1].y, ev[1].x);
764 eul.
set(ev[0].z, ev[0].y, ev[0].x);
772 Vector<T> eul((T)0.0, (T)0.0, (T)0.0, (T)0.0, -(T)1.0);
776 if (m21<-(T)1.0 || m21>(T)1.0)
return eul;
783 arctang = (T)atan2(m13, -m12);
784 ev[0].
x = arctang - ev[0].
y;
785 ev[1].
x = arctang - ev[1].
y;
791 arctang = (T)atan2(-m13, m12);
792 ev[0].
x = arctang + ev[0].
y;
793 ev[1].
x = arctang + ev[1].
y;
798 ev[0].
z = (T)asin(m21);
799 if (ev[0].z>=(T)0.0) ev[1].z = (T)
PI - ev[0].
z;
800 else ev[1].
z = -(T)
PI - ev[0].z;
802 T cz1 = (T)cos(ev[0].z);
803 T cz2 = (T)cos(ev[1].z);
806 ev[0].
x = (T)atan2(-m23/cz1, m22/cz1);
807 ev[0].
y = (T)atan2(-m31/cz1, m11/cz1);
809 if (ev[0].x>=(T)0.0) ev[1].x = ev[0].x - (T)
PI;
810 else ev[1].
x = ev[0].
x + (T)
PI;
811 if (ev[0].y>=(T)0.0) ev[1].y = ev[0].y - (T)
PI;
812 else ev[1].
y = ev[0].
y + (T)
PI;
818 vct[0].set(ev[0].x, ev[0].z, ev[0].y);
819 vct[1].set(ev[1].x, ev[1].z, ev[1].y);
821 eul.
set(ev[0].x, ev[0].z, ev[0].y);
829 Vector<T> eul((T)0.0, (T)0.0, (T)0.0, (T)0.0, -(T)1.0);
833 if (m12<-(T)1.0 || m12>(T)1.0)
return eul;
840 arctang = (T)atan2(-m31, -m21);
841 ev[0].
x = arctang - ev[0].
y;
842 ev[1].
x = arctang - ev[1].
y;
848 arctang = (T)atan2(m31, m21);
849 ev[0].
x = arctang + ev[0].
y;
850 ev[1].
x = arctang + ev[1].
y;
855 ev[0].
z = -(T)asin(m12);
856 if (ev[0].z>=0.0) ev[1].
z = (T)
PI - ev[0].z;
857 else ev[1].
z = -(T)
PI - ev[0].z;
859 T cz1 = (T)cos(ev[0].z);
860 T cz2 = (T)cos(ev[1].z);
863 ev[0].
x = (T)atan2(m32/cz1, m22/cz1);
864 ev[0].
y = (T)atan2(m13/cz1, m11/cz1);
866 if (ev[0].x>=(T)0.0) ev[1].x = ev[0].x - (T)
PI;
867 else ev[1].
x = ev[0].
x + (T)
PI;
868 if (ev[0].y>=(T)0.0) ev[1].y = ev[0].y - (T)
PI;
869 else ev[1].
y = ev[0].
y + (T)
PI;
875 vct[0].set(ev[0].y, ev[0].z, ev[0].x);
876 vct[1].set(ev[1].y, ev[1].z, ev[1].x);
878 eul.
set(ev[0].y, ev[0].z, ev[0].x);
886 Vector<T> eul((T)0.0, (T)0.0, (T)0.0, (T)0.0, -(T)1.0);
890 if (m32<-(T)1.0 || m32>(T)1.0)
return eul;
897 arctang = (T)atan2(m21, -m23);
898 ev[0].
y = arctang - ev[0].
z;
899 ev[1].
y = arctang - ev[1].
z;
905 arctang = (T)atan2(-m21, m23);
906 ev[0].
y = arctang + ev[0].
z;
907 ev[1].
y = arctang + ev[1].
z;
912 ev[0].
x = (T)asin(m32);
913 if (ev[0].x>=0.0) ev[1].
x = (T)
PI - ev[0].x;
914 else ev[1].
x = -(T)
PI - ev[0].x;
916 T cx1 = (T)cos(ev[0].x);
917 T cx2 = (T)cos(ev[1].x);
920 ev[0].
y = (T)atan2(-m31/cx1, m33/cx1);
921 ev[0].
z = (T)atan2(-m12/cx1, m22/cx1);
923 if (ev[0].y>=(T)0.0) ev[1].y = ev[0].y - (T)
PI;
924 else ev[1].
y = ev[0].
y + (T)
PI;
925 if (ev[0].z>=(T)0.0) ev[1].z = ev[0].z - (T)
PI;
926 else ev[1].
z = ev[0].
z + (T)
PI;
932 vct[0].set(ev[0].y, ev[0].x, ev[0].z);
933 vct[1].set(ev[1].y, ev[1].x, ev[1].z);
935 eul.
set(ev[0].y, ev[0].x, ev[0].z);
943 Vector<T> eul((T)0.0, (T)0.0, (T)0.0, (T)0.0, -(T)1.0);
947 if (m23<-(T)1.0 || m23>(T)1.0)
return eul;
954 arctang = (T)atan2(-m12, -m32);
955 ev[0].
y = arctang - ev[0].
z;
956 ev[1].
y = arctang - ev[1].
z;
962 arctang = (T)atan2(m12, m32);
963 ev[0].
y = arctang + ev[0].
z;
964 ev[1].
y = arctang + ev[1].
z;
969 ev[0].
x = -(T)asin(m23);
970 if (ev[0].x>=(T)0.0) ev[1].x = (T)
PI - ev[0].
x;
971 else ev[1].
x = -(T)
PI - ev[0].x;
973 T cx1 = (T)cos(ev[0].x);
974 T cx2 = (T)cos(ev[1].x);
977 ev[0].
y = (T)atan2(m13/cx1, m33/cx1);
978 ev[0].
z = (T)atan2(m21/cx1, m22/cx1);
980 if (ev[0].y>=(T)0.0) ev[1].y = ev[0].y - (T)
PI;
981 else ev[1].
y = ev[0].
y + (T)
PI;
982 if (ev[0].z>=(T)0.0) ev[1].z = ev[0].z - (T)
PI;
983 else ev[1].
z = ev[0].
z + (T)
PI;
989 vct[0].set(ev[0].z, ev[0].x, ev[0].y);
990 vct[1].set(ev[1].z, ev[1].x, ev[1].y);
992 eul.
set(ev[0].z, ev[0].x, ev[0].y);
1010 Vector<T> eul = RotMatrixElements2ExtEulerXYZ<T>(m11, m12, m13, m21, m31, m32, m33, vct);
1027 Vector<T> eul = RotMatrixElements2ExtEulerZYX<T>(m11, m12, m13, m21, m23, m31, m33, vct);
1043 Vector<T> eul = RotMatrixElements2ExtEulerXZY<T>(m11, m12, m13, m21, m22, m23, m31, vct);
1059 Vector<T> eul = RotMatrixElements2ExtEulerYZX<T>(m11, m12, m13, m21, m22, m31, m32, vct);
1075 Vector<T> eul = RotMatrixElements2ExtEulerYXZ<T>(m12, m21, m22, m23, m31, m32, m33, vct);
1091 Vector<T> eul = RotMatrixElements2ExtEulerZXY<T>(m12, m13, m21, m22, m23, m32, m33, vct);
1103 Vector<T> eul = RotMatrix2ExtEulerXYZ<T>(mtx, vct);
1191 vect.
x = (q.
s*q.
s + q.
x*q.
x - q.
y*q.
y -q.
z*q.
z)*v.
x +
1192 ((T)2.0*q.
x*q.
y - (T)2.0*q.
s*q.
z)*v.
y +
1193 ((T)2.0*q.
x*q.
z + (T)2.0*q.
s*q.
y)*v.
z;
1195 vect.
y = ((T)2.0*q.
x*q.
y + (T)2.0*q.
s*q.
z)*v.
x +
1196 (q.
s*q.
s - q.
x*q.
x + q.
y*q.
y - q.
z*q.
z)*v.
y +
1197 ((T)2.0*q.
y*q.
z - (T)2.0*q.
s*q.
x)*v.
z;
1199 vect.
z = ((T)2.0*q.
x*q.
z - (T)2.0*q.
s*q.
y)*v.
x +
1200 ((T)2.0*q.
y*q.
z + (T)2.0*q.
s*q.
x)*v.
y +
1201 (q.
s*q.
s - q.
x*q.
x - q.
y*q.
y + q.
z*q.
z)*v.
z;
1211 vect.
x = (q.
s*q.
s + q.
x*q.
x - q.
y*q.
y -q.
z*q.
z)*v.
x +
1212 ((T)2.0*q.
x*q.
y + (T)2.0*q.
s*q.
z)*v.
y +
1213 ((T)2.0*q.
x*q.
z - (T)2.0*q.
s*q.
y)*v.
z;
1215 vect.
y = ((T)2.0*q.
x*q.
y - (T)2.0*q.
s*q.
z)*v.
x +
1216 (q.
s*q.
s - q.
x*q.
x + q.
y*q.
y - q.
z*q.
z)*v.
y +
1217 ((T)2.0*q.
y*q.
z + (T)2.0*q.
s*q.
x)*v.
z;
1219 vect.
z = ((T)2.0*q.
x*q.
z + (T)2.0*q.
s*q.
y)*v.
x +
1220 ((T)2.0*q.
y*q.
z - (T)2.0*q.
s*q.
x)*v.
y +
1221 (q.
s*q.
s - q.
x*q.
x - q.
y*q.
y + q.
z*q.
z)*v.
z;
1231 x = (q.
s*q.
s + q.
x*q.
x - q.
y*q.
y -q.
z*q.
z)*v[0] +
1232 ((T)2.0*q.
x*q.
y - (T)2.0*q.
s*q.
z)*v[1] +
1233 ((T)2.0*q.
x*q.
z + (T)2.0*q.
s*q.
y)*v[2];
1235 y = ((T)2.0*q.
x*q.
y + (T)2.0*q.
s*q.
z)*v[0] +
1236 (q.
s*q.
s - q.
x*q.
x + q.
y*q.
y - q.
z*q.
z)*v[1] +
1237 ((T)2.0*q.
y*q.
z - (T)2.0*q.
s*q.
x)*v[2];
1239 z = ((T)2.0*q.
x*q.
z - (T)2.0*q.
s*q.
y)*v[0] +
1240 ((T)2.0*q.
y*q.
z + (T)2.0*q.
s*q.
x)*v[1] +
1241 (q.
s*q.
s - q.
x*q.
x - q.
y*q.
y + q.
z*q.
z)*v[2];
1255 x = (q.
s*q.
s + q.
x*q.
x - q.
y*q.
y -q.
z*q.
z)*v[0] +
1256 ((T)2.0*q.
x*q.
y + (T)2.0*q.
s*q.
z)*v[1] +
1257 ((T)2.0*q.
x*q.
z - (T)2.0*q.
s*q.
y)*v[2];
1259 y = ((T)2.0*q.
x*q.
y - (T)2.0*q.
s*q.
z)*v[0] +
1260 (q.
s*q.
s - q.
x*q.
x + q.
y*q.
y - q.
z*q.
z)*v[1] +
1261 ((T)2.0*q.
y*q.
z + (T)2.0*q.
s*q.
x)*v[2];
1263 z = ((T)2.0*q.
x*q.
z + (T)2.0*q.
s*q.
y)*v[0] +
1264 ((T)2.0*q.
y*q.
z - (T)2.0*q.
s*q.
x)*v[1] +
1265 (q.
s*q.
s - q.
x*q.
x - q.
y*q.
y + q.
z*q.
z)*v[2];
1286 T cs2 = (a*b)/(T)2.0;
1289 if (cs2>(T)0.5) sn = (T)0.0;
1290 else sn = (T)sqrt(0.5 - cs2);
1294 if (c.
norm()<(T)1.0) {
1309 if (cs2<-(T)0.5) cs = (T)0.0;
1310 else cs = (T)sqrt(0.5 + cs2);
1313 if (cs>(T)1.0) qut.
set((T)1.0, (T)0.0, (T)0.0, (T)0.0, (T)1.0, -(T)1.0);
1314 else qut.
set(cs, nr.
x*sn, nr.
y*sn, nr.
z*sn, (T)1.0, (T)
Min(a.
c, b.
c));
1324 if (a.
c<(T)0.0 || b.
c<(T)0.0 || c.
c<(T)0.0)
return qut;
1326 qut = V2VQuaternion<T>(b-a, c-b);
1335 if (a.
c<(T)0.0 || b.
c<(T)0.0 || c.
c<(T)0.0)
return qut;
1337 qut = V2VQuaternion<T>(a, c-b);
1346 if (a.
c<(T)0.0 || b.
c<(T)0.0 || c.
c<(T)0.0)
return qut;
1348 qut = V2VQuaternion<T>(b-a, c);
1387 if (dot>(T)1.0) dot = 1.0;
1388 else if (dot<-(T)1.0) dot = -1.0;
1394 T angd = angb - anga;
1395 if (angd<-(T)
PI) angd += (T)
PI2;
1396 else if (angd>(T)
PI) angd -= (T)
PI2;
1398 T angc = anga + t*angd;
1406 else if (dot<-(T)0.99) {
1409 T angd = angb - anga;
1410 if (angd<-(T)
PI) angd += (T)
PI2;
1411 else if (angd>(T)
PI) angd -= (T)
PI2;
1413 T angc = anga + t*angd;
1420 dot = qa.
x*qb.
x + qa.
y*qb.
y + qa.
z*qb.
z + qa.
s*qb.
s;
1421 if (dot>(T)1.0) dot = (T)1.0;
1422 else if (dot<(T)0.0) {
1423 if (t<=(T)0.5)
return qa;
1429 T th = (T)acos(dot);
1434 qc = qa*((T)sin(((T)1.0-t)*th)/sn) + qb*((T)sin(t*th)/sn);
void free()
free() は手動で呼び出す.
Quaternion(T S, Vector< T > v)
void setExtEulerXZY(Vector< T > e)
X->Z->Y.
Vector< T > getExtEulerXYZ(Vector< T > *vt=NULL)
void set(T S, T X, T Y, T Z, T N=(T) 0.0, T C=(T) 1.0)
Vector< T > getExtEulerYZX(Vector< T > *vt=NULL)
Vector< T > getExtEulerXZY(Vector< T > *vt=NULL)
void setRotation(T e, Vector< T > v)
void setRotate(T e, Vector< T > v)
void setRotate(T e, T X, T Y, T Z, T N=(T) 0.0)
virtual ~Quaternion(void)
Matrix< T > getRotMatrix()
void setExtEulerZYX(Vector< T > e)
Z->Y->X.
void setExtEulerXYZ(Vector< T > e)
X->Y->Z.
Vector< T > getExtEulerYXZ(Vector< T > *vt=NULL)
void setExtEulerYXZ(Vector< T > e)
Y->X->Z.
Vector< T > getExtEulerZYX(Vector< T > *vt=NULL)
Vector< T > execInvRotate(Vector< T > v)
Vector< T > execRotate(Vector< T > v)
Vector< T > execInvRotation(Vector< T > v)
Exec Inv Rotation (~q)vq.
void setExtEulerZXY(Vector< T > e)
Z->X->Y.
Vector< T > execRotation(Vector< T > v)
Exec Rotation qv(~q)
Quaternion(T S, T X, T Y, T Z, T N=(T) 0.0, T C=(T) 1.0)
Vector< T > getExtEulerZXY(Vector< T > *vt=NULL)
void setRotation(T e, T X, T Y, T Z, T N=(T) 0.0)
void setExtEulerYZX(Vector< T > e)
Y->Z->X.
Vector< T > normalize(void)
void set(T X, T Y=0, T Z=0, double N=0.0, double C=1.0, int D=0)
Matrix< T > ExtEulerYXZ2RotMatrix(Vector< T > eul)
Quaternion< T > PPVQuaternion(Vector< T > a, Vector< T > b, Vector< T > c)
Quaternion< T > ExtEulerXYZ2Quaternion(Vector< T > e)
Vector< T > Quaternion2ExtEulerXYZ(Quaternion< T > qut, Vector< T > *vct=NULL)
Vector< T > RotMatrix2ExtEulerZXY(Matrix< T > mtx, Vector< T > *vct=NULL)
Vector< T > RotMatrix2ExtEulerYXZ(Matrix< T > mtx, Vector< T > *vct=NULL)
Quaternion< T > ExtEulerYXZ2Quaternion(Vector< T > e)
Quaternion< T > operator~(const Quaternion< T > a)
AffineTrans< T > operator*(AffineTrans< T > a, AffineTrans< T > b)
Matrix< T > operator+(const Matrix< T > a, const Matrix< T > b)
Matrix< T > ExtEulerZXY2RotMatrix(Vector< T > eul)
Vector< T > RotMatrixElements2ExtEulerYXZ(T m12, T m21, T m22, T m23, T m31, T m32, T m33, Vector< T > *vct=NULL)
double Zero_Eps
1に対して 0とするトレランス
Quaternion< T > ExtEulerZXY2Quaternion(Vector< T > e)
Matrix< T > ExtEulerXZY2RotMatrix(Vector< T > eul)
Vector< T > VectorRotation(Vector< T > v, Quaternion< T > q)
Matrix< T > operator/(const Matrix< T > a, const R d)
bool operator==(const Matrix< T > v1, const Matrix< T > v2)
Vector< T > Quaternion2ExtEulerZXY(Quaternion< T > qut, Vector< T > *vct=NULL)
Vector< T > RotMatrix2ExtEulerXYZ(Matrix< T > mtx, Vector< T > *vct=NULL)
bool operator!=(const Quaternion< T > q1, const Quaternion< T > q2)
~ 共役
Vector< T > RotMatrixElements2ExtEulerZXY(T m12, T m13, T m21, T m22, T m23, T m32, T m33, Vector< T > *vct=NULL)
double Sin_Tolerance
sinθ==0
Quaternion< T > ExtEulerZYX2Quaternion(Vector< T > e)
Vector< T > RotMatrix2ExtEulerXZY(Matrix< T > mtx, Vector< T > *vct=NULL)
Vector< T > RotMatrix2ExtEulerZYX(Matrix< T > mtx, Vector< T > *vct)
Vector< T > VectorInvRotation(Vector< T > v, Quaternion< T > q)
Quaternion< T > ExtEulerYZX2Quaternion(Vector< T > e)
Vector< T > Quaternion2ExtEulerYXZ(Quaternion< T > qut, Vector< T > *vct=NULL)
Vector< T > Quaternion2ExtEulerXZY(Quaternion< T > qut, Vector< T > *vct=NULL)
Vector< T > Quaternion2ExtEulerYZX(Quaternion< T > qut, Vector< T > *vct=NULL)
Quaternion< T > ExtEulerXZY2Quaternion(Vector< T > e)
Vector< T > RotMatrixElements2ExtEulerZYX(T m11, T m12, T m13, T m21, T m23, T m31, T m33, Vector< T > *vct=NULL)
Quaternion< T > SlerpQuaternion(Quaternion< T > qa, Quaternion< T > qb, T t)
Quaternion< T > V2VQuaternion(Vector< T > a, Vector< T > b)
Quaternion< T > VPPQuaternion(Vector< T > a, Vector< T > b, Vector< T > c)
Quaternion< T > RotMatrix2Quaternion(Matrix< T > mtx)
Vector< T > RotMatrix2ExtEulerYZX(Matrix< T > mtx, Vector< T > *vct=NULL)
Quaternion< T > PPPQuaternion(Vector< T > a, Vector< T > b, Vector< T > c)
Vector< T > RotMatrixElements2ExtEulerXZY(T m11, T m12, T m13, T m21, T m22, T m23, T m31, Vector< T > *vct=NULL)
Matrix< T > operator-(const Matrix< T > a)
Matrix< T > ExtEulerZYX2RotMatrix(Vector< T > eul)
Vector< T > RotMatrixElements2ExtEulerYZX(T m11, T m12, T m13, T m21, T m22, T m31, T m32, Vector< T > *vct=NULL)
Vector< T > Quaternion2ExtEulerZYX(Quaternion< T > qut, Vector< T > *vct=NULL)
Matrix< T > ExtEulerYZX2RotMatrix(Vector< T > eul)
Matrix< T > ExtEulerXYZ2RotMatrix(Vector< T > eul)
Vector< T > RotMatrixElements2ExtEulerXYZ(T m11, T m12, T m13, T m21, T m31, T m32, T m33, Vector< T > *vct=NULL)