76 fA1(0), fA2(0), fA3(0), fAsOK(
kFALSE),
166 memcpy(
fM, t.
fM,
sizeof(
fM));
167 if (copyAngles && t.
fAsOK) {
180 for(
Int_t i=0; i<16; ++i)
fM[i] = arr[i];
189 for(
Int_t i=0; i<16; ++i)
fM[i] = arr[i];
205 t(i,j) = -s; t(j,i) = s;
221 static const float kFromToEpsilon = 0.000001f;
227 f = (e < 0.0f) ? -e : e;
229 if (f > 1.0f - kFromToEpsilon)
235 x.
fX = (from.
fX > 0.0f) ? from.
fX : -from.
fX;
236 x.
fY = (from.
fY > 0.0f) ? from.
fY : -from.
fY;
237 x.
fZ = (from.
fZ > 0.0f) ? from.
fZ : -from.
fZ;
242 x.
fX = 1.0f; x.
fY = x.
fZ = 0.0f;
244 x.
fZ = 1.0f; x.
fX = x.
fY = 0.0f;
250 x.
fY = 1.0f; x.
fX = x.
fZ = 0.0f;
252 x.
fZ = 1.0f; x.
fX = x.
fY = 0.0f;
259 c1 = 2.0f / u.
Mag2();
260 c2 = 2.0f / v.
Mag2();
261 c3 = c1 * c2 * u.
Dot(v);
263 for (
int i = 0; i < 3; i++) {
264 for (
int j = 0; j < 3; j++) {
265 CM(i, j) = - c1 * u[i] * u[j]
276 Float_t h, hvx, hvz, hvxy, hvxz, hvyz;
284 CM(0, 0) = e + hvx * v.
fX;
285 CM(0, 1) = hvxy - v.
fZ;
286 CM(0, 2) = hvxz + v.
fY;
288 CM(1, 0) = hvxy + v.
fZ;
289 CM(1, 1) = e + h * v.
fY * v.
fY;
290 CM(1, 2) = hvyz - v.
fX;
292 CM(2, 0) = hvxz - v.
fY;
293 CM(2, 1) = hvyz + v.
fX;
294 CM(2, 2) = e + hvz * v.
fZ;
305 for(
int c=0; c<4; ++c, col+=4) {
307 for(
int r=0;
r<4; ++
r, ++row)
308 buf[
r] = row[0]*col[0] + row[4]*col[1] + row[8]*col[2] + row[12]*col[3];
309 col[0] = buf[0]; col[1] = buf[1]; col[2] = buf[2]; col[3] = buf[3];
321 for(
int r=0;
r<4; ++
r, ++row) {
323 for(
int c=0; c<4; ++c, col+=4)
324 buf[c] = row[0]*col[0] + row[4]*col[1] + row[8]*col[2] + row[12]*col[3];
325 row[0] = buf[0]; row[4] = buf[1]; row[8] = buf[2]; row[12] = buf[3];
359 fM[
F03] += amount*col[0];
fM[
F13] += amount*col[1];
fM[
F23] += amount*col[2];
368 fM[
F13] += x*fM[1] + y*fM[5] + z*fM[9];
369 fM[
F23] += x*fM[2] + y*fM[6] + z*fM[10];
383 --i1 <<= 2; --i2 <<= 2;
384 for (
int r=0;
r<4; ++
r, ++row) {
385 b1 = cos*row[i1] +
sin*row[i2];
386 b2 = cos*row[i2] -
sin*row[i1];
387 row[i1] = b1; row[i2] = b2;
397 fM[
F03 + --ai] += amount;
423 for(
int c=0; c<4; ++c, col+=4) {
424 b1 = cos*col[i1] -
sin*col[i2];
425 b2 = cos*col[i2] +
sin*col[i1];
426 col[i1] = b1; col[i2] = b2;
437 fM[
F03] += amount*vec[0];
438 fM[
F13] += amount*vec[1];
439 fM[
F23] += amount*vec[2];
474 col[0] =
x; col[1] =
y; col[2] =
z;
501 v.
SetXYZ(col[0], col[1], col[2]);
577 clamp_angle(a1); clamp_angle(a2); clamp_angle(a3);
605 int n = strspn(pat,
"XxYyZz");
if(n > 3) n = 3;
609 for(
int i=0; i<
n; i++) {
610 if(isupper(pat[i])) a[i] = -a[i];
612 case 'x':
case 'X':
RotateLF(2, 3, a[i]);
break;
613 case 'y':
case 'Y':
RotateLF(3, 1, a[i]);
break;
614 case 'z':
case 'Z':
RotateLF(1, 2, a[i]);
break;
629 if(d>1) d=1;
else if(d<-1) d=-1;
661 return (sx + sy + sz)/3;
793 Double_t t[3] = { v[0], v[1], v[2] };
805 Double_t t[3] = { v[0], v[1], v[2] };
829 c[0] /=
l; c[1] /=
l; c[2] /=
l;
840 const Double_t dp = c[0]*rc[0] + c[1]*rc[1] + c[2]*rc[2];
841 c[0] -= rc[0]*dp; c[1] -= rc[1]*dp; c[2] -= rc[2]*dp;
888 const Double_t det3_012_012 = fM[
F00]*det2_12_12 - fM[
F01]*det2_12_02 + fM[
F02]*det2_12_01;
889 const Double_t det3_012_013 = fM[
F00]*det2_12_13 - fM[
F01]*det2_12_03 + fM[
F03]*det2_12_01;
890 const Double_t det3_012_023 = fM[
F00]*det2_12_23 - fM[
F02]*det2_12_03 + fM[
F03]*det2_12_02;
891 const Double_t det3_012_123 = fM[
F01]*det2_12_23 - fM[
F02]*det2_12_13 + fM[
F03]*det2_12_12;
892 const Double_t det3_013_012 = fM[
F00]*det2_13_12 - fM[
F01]*det2_13_02 + fM[
F02]*det2_13_01;
893 const Double_t det3_013_013 = fM[
F00]*det2_13_13 - fM[
F01]*det2_13_03 + fM[
F03]*det2_13_01;
894 const Double_t det3_013_023 = fM[
F00]*det2_13_23 - fM[
F02]*det2_13_03 + fM[
F03]*det2_13_02;
895 const Double_t det3_013_123 = fM[
F01]*det2_13_23 - fM[
F02]*det2_13_13 + fM[
F03]*det2_13_12;
896 const Double_t det3_023_012 = fM[
F00]*det2_23_12 - fM[
F01]*det2_23_02 + fM[
F02]*det2_23_01;
897 const Double_t det3_023_013 = fM[
F00]*det2_23_13 - fM[
F01]*det2_23_03 + fM[
F03]*det2_23_01;
898 const Double_t det3_023_023 = fM[
F00]*det2_23_23 - fM[
F02]*det2_23_03 + fM[
F03]*det2_23_02;
899 const Double_t det3_023_123 = fM[
F01]*det2_23_23 - fM[
F02]*det2_23_13 + fM[
F03]*det2_23_12;
900 const Double_t det3_123_012 = fM[
F10]*det2_23_12 - fM[
F11]*det2_23_02 + fM[
F12]*det2_23_01;
901 const Double_t det3_123_013 = fM[
F10]*det2_23_13 - fM[
F11]*det2_23_03 + fM[
F13]*det2_23_01;
902 const Double_t det3_123_023 = fM[
F10]*det2_23_23 - fM[
F12]*det2_23_03 + fM[
F13]*det2_23_02;
903 const Double_t det3_123_123 = fM[
F11]*det2_23_23 - fM[
F12]*det2_23_13 + fM[
F13]*det2_23_12;
906 const Double_t det = fM[
F00]*det3_123_123 - fM[
F01]*det3_123_023 +
907 fM[
F02]*det3_123_013 - fM[
F03]*det3_123_012;
910 throw(eh +
"matrix is singular.");
913 const Double_t oneOverDet = 1.0/det;
914 const Double_t mn1OverDet = - oneOverDet;
916 fM[
F00] = det3_123_123 * oneOverDet;
917 fM[
F01] = det3_023_123 * mn1OverDet;
918 fM[
F02] = det3_013_123 * oneOverDet;
919 fM[
F03] = det3_012_123 * mn1OverDet;
921 fM[
F10] = det3_123_023 * mn1OverDet;
922 fM[
F11] = det3_023_023 * oneOverDet;
923 fM[
F12] = det3_013_023 * mn1OverDet;
924 fM[
F13] = det3_012_023 * oneOverDet;
926 fM[
F20] = det3_123_013 * oneOverDet;
927 fM[
F21] = det3_023_013 * mn1OverDet;
928 fM[
F22] = det3_013_013 * oneOverDet;
929 fM[
F23] = det3_012_013 * mn1OverDet;
931 fM[
F30] = det3_123_012 * mn1OverDet;
932 fM[
F31] = det3_023_012 * oneOverDet;
933 fM[
F32] = det3_013_012 * mn1OverDet;
934 fM[
F33] = det3_012_012 * oneOverDet;
943 void TEveTrans::Streamer(
TBuffer &R__b)
959 for(
Int_t i=0; i<4; ++i, ++row)
960 printf(
"%8.3f %8.3f %8.3f | %8.3f\n", row[0], row[4], row[8], row[12]);
970 s.setf(std::ios::fixed, std::ios::floatfield);
972 for(
Int_t i=1; i<=4; i++)
973 for(
Int_t j=1; j<=4; j++)
974 s << t(i,j) << ((j==4) ?
"\n" :
"\t");
1002 m[0] = r[0]*s[0]; m[1] = r[3]*s[0]; m[2] = r[6]*s[0]; m[3] = 0;
1003 m[4] = r[1]*s[1]; m[5] = r[4]*s[1]; m[6] = r[7]*s[1]; m[7] = 0;
1004 m[8] = r[2]*s[2]; m[9] = r[5]*s[2]; m[10] = r[8]*s[2]; m[11] = 0;
1005 m[12] = t[0]; m[13] = t[1]; m[14] = t[2]; m[15] = 1;
1009 m[0] = r[0]; m[1] = r[3]; m[2] = r[6]; m[3] = 0;
1010 m[4] = r[1]; m[5] = r[4]; m[6] = r[7]; m[7] = 0;
1011 m[8] = r[2]; m[9] = r[5]; m[10] = r[8]; m[11] = 0;
1012 m[12] = t[0]; m[13] = t[1]; m[14] = t[2]; m[15] = 1;
1030 r[0] = m[0]/s[0]; r[3] = m[1]/s[0]; r[6] = m[2]/s[0]; m += 4;
1031 r[1] = m[0]/s[1]; r[4] = m[1]/s[1]; r[7] = m[2]/s[1]; m += 4;
1032 r[2] = m[0]/s[2]; r[5] = m[1]/s[2]; r[8] = m[2]/s[2]; m += 4;
1033 t[0] = m[0]; t[1] = m[1]; t[2] = m[2];
1038 r[0] = 1; r[3] = 0; r[6] = 0;
1039 r[1] = 0; r[4] = 1; r[7] = 0;
1040 r[2] = 0; r[5] = 0; r[8] = 1;
1041 s[0] = s[1] = s[2] = 1;
1042 t[0] = t[1] = t[2] = 0;
1057 m[0] =
fM[0]; m[1] =
fM[4]; m[2] =
fM[8]; m[3] =
fM[3];
1058 m[4] =
fM[1]; m[5] =
fM[5]; m[6] =
fM[9]; m[7] =
fM[7];
1059 m[8] =
fM[2]; m[9] =
fM[6]; m[10] =
fM[10]; m[11] =
fM[11];
1060 m[12] =
fM[12]; m[13] =
fM[13]; m[14] =
fM[14]; m[15] =
fM[15];
1079 if (s < low || s > high)
return kTRUE;
1081 if (s < low || s > high)
return kTRUE;
1083 if (s < low || s > high)
return kTRUE;
TEveTrans is a 4x4 transformation matrix for homogeneous coordinates stored internally in a column-ma...
void MultLeft(const TEveTrans &t)
Multiply from left: this = t * this.
TEveTrans()
Default constructor.
void OrtoNorm3()
Orto-norm columns 1 to 3.
void MultRight(const TEveTrans &t)
Multiply from right: this = this * t.
Geometrical transformation package.
constexpr Double_t TwoPi()
virtual const Double_t * GetRotationMatrix() const
void SetScale(Double_t sx, Double_t sy, Double_t sz)
Set scaling.
virtual const Double_t * GetTranslation() const
virtual const Double_t * GetRotationMatrix() const =0
TT Dot(const TEveVectorT &a) const
void SetScaleX(Double_t sx)
Change x scaling.
Buffer base class used for serializing objects.
Double_t fLocalMaster[16]
void SetScaleZ(Double_t sz)
Change z scaling.
virtual const Double_t * GetScale() const
TEveVectorT Cross(const TEveVectorT &a) const
Matrix class used for computing global transformations Should NOT be used for node definition...
void UnitRot()
Reset rotation part of the matrix to unity.
TVector3 GetBaseVec(Int_t b) const
Get base-vector with index b.
void MultiplyIP(TVector3 &v, Double_t w=1) const
Multiply vector in-place.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Double_t Unscale()
Remove scaling, make all base vectors of unit length.
TEveTrans operator*(const TEveTrans &t)
Copy, multiply from right and return product.
void Move3LF(Double_t x, Double_t y, Double_t z)
General move in local-frame.
void SetRotByAngles(Float_t a1, Float_t a2, Float_t a3)
Double_t Orto3Column(Int_t col, Int_t ref)
Orto-norm 3-vector in column col with respect to column ref.
void Move(const TEveTrans &a, Int_t ai, Double_t amount)
Move in a's coord-system along axis-index ai.
void SetXYZ(Double_t x, Double_t y, Double_t z)
void GetXYZ(Double_t *carray) const
void ZeroTrans(Double_t w=1.0)
Reset matrix to zero, only the perspective scaling is set to w (1 by default).
Double_t ATan2(Double_t, Double_t)
void Scale(Double_t sx, Double_t sy, Double_t sz)
Scale matrix. Translation part untouched.
virtual void Print(Option_t *option="") const
Print in reasonable format.
void SetScaleY(Double_t sy)
Change y scaling.
void SetupRotation(Int_t i, Int_t j, Double_t f)
Setup the matrix as an elementary rotation.
void SetFrom(Double_t *carr)
Bool_t IsScale(Double_t low=0.9, Double_t high=1.1) const
Test if the transformation is a scale.
void RotatePF(Int_t i1, Int_t i2, Double_t amount)
Rotate in parent frame. Does optimised version of MultLeft.
TVector3 is a general three vector class, which can be used for the description of different vectors ...
Double_t CM(Int_t i, Int_t j) const
void RotateIP(TVector3 &v) const
Rotate vector in-place. Translation is NOT applied.
void SetBuffer3D(TBuffer3D &buff)
Fill transformation part TBuffer3D core section.
void TransposeRotationPart()
Transpose 3x3 rotation sub-matrix.
void SetBaseVec(Int_t b, Double_t x, Double_t y, Double_t z)
Set base-vector with index b.
void SetRotByAnyAngles(Float_t a1, Float_t a2, Float_t a3, const char *pat)
Sets Rotation part as given by angles a1, a1, a3 and pattern pat.
Generic 3D primitive description class.
void GetScale(Double_t &sx, Double_t &sy, Double_t &sz) const
Deduce scales from sizes of base vectors.
void SetTrans(const TEveTrans &t, Bool_t copyAngles=kTRUE)
Set matrix from another,.
std::ostream & operator<<(std::ostream &s, const TEveTrans &t)
Print to std::ostream.
void MovePF(Int_t ai, Double_t amount)
Move in parent-frame along axis index ai.
void SetPos(Double_t x, Double_t y, Double_t z)
Set position (base-vec 4).
void MoveLF(Int_t ai, Double_t amount)
Move in local-frame along axis with index ai.
Double_t Invert()
Invert matrix.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
TVector3 Multiply(const TVector3 &v, Double_t w=1) const
Multiply vector and return it.
void RotateLF(Int_t i1, Int_t i2, Double_t amount)
Rotate in local frame. Does optimised version of MultRight.
Mother of all ROOT objects.
you should not use this method at all Int_t Int_t z
void SetupFromToVec(const TEveVector &from, const TEveVector &to)
A function for creating a rotation matrix that rotates a vector called "from" into another vector cal...
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
void SetGeoHMatrix(TGeoHMatrix &mat)
Set TGeoHMatrix mat.
void Move3(const TEveTrans &a, Double_t x, Double_t y, Double_t z)
General move in a's coord-system.
Exception class thrown by TEve classes and macros.
TEveVectorT & Sub(const TEveVectorT &a, const TEveVectorT &b)
void Rotate(const TEveTrans &a, Int_t i1, Int_t i2, Double_t amount)
Rotate in a's coord-system, rotating base vector with index i1 into i2.
Double_t Sqrt(Double_t x)
void SetFromArray(const Double_t arr[16])
Set matrix from Double_t array.
Double_t Norm3Column(Int_t col)
Norm 3-vector in column col.
virtual const Double_t * GetTranslation() const =0
void GetRotAngles(Float_t *x) const
Get Cardan rotation angles (pattern xYz above).
virtual const Double_t * GetScale() const =0
void UnitTrans()
Reset matrix to unity.
void Move3PF(Double_t x, Double_t y, Double_t z)
General move in parent-frame.