Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TEveTrans.cxx
Go to the documentation of this file.
1// @(#)root/eve:$Id$
2// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#include "TEveTrans.h"
13#include "TEveUtil.h"
14
15#include "TBuffer.h"
16#include "TClass.h"
17#include "TMath.h"
18
19#include <iostream>
20#include <cctype>
21
22#define F00 0
23#define F01 4
24#define F02 8
25#define F03 12
26
27#define F10 1
28#define F11 5
29#define F12 9
30#define F13 13
31
32#define F20 2
33#define F21 6
34#define F22 10
35#define F23 14
36
37#define F30 3
38#define F31 7
39#define F32 11
40#define F33 15
41
42/** \class TEveTrans
43\ingroup TEve
44TEveTrans is a 4x4 transformation matrix for homogeneous coordinates
45stored internally in a column-major order to allow direct usage by
46GL. The element type is Double32_t as statically the floats would
47be precise enough but continuous operations on the matrix must
48retain precision of column vectors.
49
50Cartan angles are stored in fA[1-3] (+z, -y, +x). They are
51recalculated on demand.
52
53Direct element access (first two should be used with care):
54 - operator[i] direct access to elements, i:0->15
55 - CM(i,j) element 4*j + i; i,j:0->3 { CM ~ c-matrix }
56 - operator(i,j) element 4*(j-1) + i - 1 i,j:1->4
57
58Column-vector access:
59USet Get/SetBaseVec(), Get/SetPos() and Arr[XYZT]() methods.
60
61For all methods taking the matrix indices:
621->X, 2->Y, 3->Z; 4->Position (if applicable). 0 reserved for time.
63
64Shorthands in method-names:
65LF ~ LocalFrame; PF ~ ParentFrame; IP ~ InPlace
66*/
67
69
70////////////////////////////////////////////////////////////////////////////////
71/// Default constructor.
72
74 TObject(),
75 fA1(0), fA2(0), fA3(0), fAsOK(kFALSE),
76 fUseTrans (kTRUE),
77 fEditTrans(kFALSE),
78 fEditRotation(kTRUE),
79 fEditScale(kTRUE)
80{
81 UnitTrans();
82}
83
84////////////////////////////////////////////////////////////////////////////////
85/// Constructor.
86
88 TObject(),
89 fA1(t.fA1), fA2(t.fA2), fA3(t.fA3), fAsOK(t.fAsOK),
90 fUseTrans (t.fUseTrans),
91 fEditTrans(t.fEditTrans),
92 fEditRotation(kTRUE),
93 fEditScale(kTRUE)
94{
95 SetTrans(t, kFALSE);
96}
97
98////////////////////////////////////////////////////////////////////////////////
99/// Constructor.
100
102 TObject(),
103 fA1(0), fA2(0), fA3(0), fAsOK(kFALSE),
104 fUseTrans (kTRUE),
105 fEditTrans(kFALSE),
106 fEditRotation(kTRUE),
107 fEditScale(kTRUE)
108{
109 SetFromArray(arr);
110}
111
112////////////////////////////////////////////////////////////////////////////////
113/// Constructor.
114
116 TObject(),
117 fA1(0), fA2(0), fA3(0), fAsOK(kFALSE),
118 fUseTrans (kTRUE),
119 fEditTrans(kFALSE),
120 fEditRotation(kTRUE),
121 fEditScale(kTRUE)
122{
123 SetFromArray(arr);
124}
125
126////////////////////////////////////////////////////////////////////////////////
127/// Reset matrix to unity.
128
130{
131 memset(fM, 0, 16*sizeof(Double_t));
132 fM[F00] = fM[F11] = fM[F22] = fM[F33] = 1;
133 fA1 = fA2 = fA3 = 0;
134 fAsOK = kTRUE;
135}
136
137////////////////////////////////////////////////////////////////////////////////
138/// Reset matrix to zero, only the perspective scaling is set to w
139/// (1 by default).
140
142{
143 memset(fM, 0, 16*sizeof(Double_t));
144 fM[F33] = w;
145 fA1 = fA2 = fA3 = 0;
146 fAsOK = kFALSE;
147}
148
149////////////////////////////////////////////////////////////////////////////////
150/// Reset rotation part of the matrix to unity.
151
153{
154 memset(fM, 0, 12*sizeof(Double_t));
155 fM[F00] = fM[F11] = fM[F22] = 1;
156 fA1 = fA2 = fA3 = 0;
157 fAsOK = kTRUE;
158}
159
160////////////////////////////////////////////////////////////////////////////////
161/// Set matrix from another,
162
163void TEveTrans::SetTrans(const TEveTrans& t, Bool_t copyAngles)
164{
165 memcpy(fM, t.fM, sizeof(fM));
166 if (copyAngles && t.fAsOK) {
167 fAsOK = kTRUE;
168 fA1 = t.fA1; fA2 = t.fA2; fA3 = t.fA3;
169 } else {
170 fAsOK = kFALSE;
171 }
172}
173
174////////////////////////////////////////////////////////////////////////////////
175/// Set matrix from Double_t array.
176
178{
179 for(Int_t i=0; i<16; ++i) fM[i] = arr[i];
180 fAsOK = kFALSE;
181}
182
183////////////////////////////////////////////////////////////////////////////////
184/// Set matrix from Float_t array.
185
187{
188 for(Int_t i=0; i<16; ++i) fM[i] = arr[i];
189 fAsOK = kFALSE;
190}
191
192////////////////////////////////////////////////////////////////////////////////
193/// Setup the matrix as an elementary rotation.
194/// Optimized versions of left/right multiplication with an elementary
195/// rotation matrix are implemented in RotatePF/RotateLF.
196/// Expects identity matrix.
197
199{
200 if(i == j) return;
201 TEveTrans& t = *this;
202 t(i,i) = t(j,j) = TMath::Cos(f);
203 Double_t s = TMath::Sin(f);
204 t(i,j) = -s; t(j,i) = s;
205 fAsOK = kFALSE;
206}
207
208////////////////////////////////////////////////////////////////////////////////
209/// A function for creating a rotation matrix that rotates a vector called
210/// "from" into another vector called "to".
211/// Input : from[3], to[3] which both must be *normalized* non-zero vectors
212/// Output: mtx[3][3] -- a 3x3 matrix in column-major form
213///
214/// Authors: Tomas Möller, John Hughes
215/// "Efficiently Building a Matrix to Rotate One Vector to Another"
216/// Journal of Graphics Tools, 4(4):1-4, 1999
217
219{
220 static const float kFromToEpsilon = 0.000001f;
221
222 ZeroTrans();
223
224 Float_t e, f;
225 e = from.Dot(to);
226 f = (e < 0.0f) ? -e : e;
227
228 if (f > 1.0f - kFromToEpsilon) /* "from" and "to"-vector almost parallel */
229 {
230 TEveVector u, v; /* temporary storage vectors */
231 TEveVector x; /* vector most nearly orthogonal to "from" */
232 Float_t c1, c2, c3; /* coefficients for later use */
233
234 x.fX = (from.fX > 0.0f) ? from.fX : -from.fX;
235 x.fY = (from.fY > 0.0f) ? from.fY : -from.fY;
236 x.fZ = (from.fZ > 0.0f) ? from.fZ : -from.fZ;
237
238 if (x.fX < x.fY)
239 {
240 if (x.fX < x.fZ) {
241 x.fX = 1.0f; x.fY = x.fZ = 0.0f;
242 } else {
243 x.fZ = 1.0f; x.fX = x.fY = 0.0f;
244 }
245 }
246 else
247 {
248 if (x.fY < x.fZ) {
249 x.fY = 1.0f; x.fX = x.fZ = 0.0f;
250 } else {
251 x.fZ = 1.0f; x.fX = x.fY = 0.0f;
252 }
253 }
254
255 u.Sub(x, from);
256 v.Sub(x, to);
257
258 c1 = 2.0f / u.Mag2();
259 c2 = 2.0f / v.Mag2();
260 c3 = c1 * c2 * u.Dot(v);
261
262 for (int i = 0; i < 3; i++) {
263 for (int j = 0; j < 3; j++) {
264 CM(i, j) = - c1 * u[i] * u[j]
265 - c2 * v[i] * v[j]
266 + c3 * v[i] * u[j];
267 }
268 CM(i, i) += 1.0;
269 }
270 }
271 else /* the most common case, unless "from"="to", or "from"=-"to" */
272 {
273 TEveVector v = from.Cross(to);
274
275 Float_t h, hvx, hvz, hvxy, hvxz, hvyz;
276 h = 1.0f/(1.0f + e);
277 hvx = h * v.fX;
278 hvz = h * v.fZ;
279 hvxy = hvx * v.fY;
280 hvxz = hvx * v.fZ;
281 hvyz = hvz * v.fY;
282
283 CM(0, 0) = e + hvx * v.fX;
284 CM(0, 1) = hvxy - v.fZ;
285 CM(0, 2) = hvxz + v.fY;
286
287 CM(1, 0) = hvxy + v.fZ;
288 CM(1, 1) = e + h * v.fY * v.fY;
289 CM(1, 2) = hvyz - v.fX;
290
291 CM(2, 0) = hvxz - v.fY;
292 CM(2, 1) = hvyz + v.fX;
293 CM(2, 2) = e + hvz * v.fZ;
294 }
295}
296
297////////////////////////////////////////////////////////////////////////////////
298/// Multiply from left: this = t * this.
299
301{
302 Double_t buf[4];
303 Double_t* col = fM;
304 for(int c=0; c<4; ++c, col+=4) {
305 const Double_t* row = t.fM;
306 for(int r=0; r<4; ++r, ++row)
307 buf[r] = row[0]*col[0] + row[4]*col[1] + row[8]*col[2] + row[12]*col[3];
308 col[0] = buf[0]; col[1] = buf[1]; col[2] = buf[2]; col[3] = buf[3];
309 }
310 fAsOK = kFALSE;
311}
312
313////////////////////////////////////////////////////////////////////////////////
314/// Multiply from right: this = this * t.
315
317{
318 Double_t buf[4];
319 Double_t* row = fM;
320 for(int r=0; r<4; ++r, ++row) {
321 const Double_t* col = t.fM;
322 for(int c=0; c<4; ++c, col+=4)
323 buf[c] = row[0]*col[0] + row[4]*col[1] + row[8]*col[2] + row[12]*col[3];
324 row[0] = buf[0]; row[4] = buf[1]; row[8] = buf[2]; row[12] = buf[3];
325 }
326 fAsOK = kFALSE;
327}
328
329////////////////////////////////////////////////////////////////////////////////
330/// Copy, multiply from right and return product.
331/// Avoid unless necessary.
332
334{
335 TEveTrans b(*this);
336 b.MultRight(t);
337 return b;
338}
339
340////////////////////////////////////////////////////////////////////////////////
341/// Transpose 3x3 rotation sub-matrix.
342
344{
345 Double_t x;
346 x = fM[F01]; fM[F01] = fM[F10]; fM[F10] = x;
347 x = fM[F02]; fM[F02] = fM[F20]; fM[F20] = x;
348 x = fM[F12]; fM[F12] = fM[F21]; fM[F21] = x;
349 fAsOK = kFALSE;
350}
351
352////////////////////////////////////////////////////////////////////////////////
353/// Move in local-frame along axis with index ai.
354
356{
357 const Double_t *col = fM + 4*--ai;
358 fM[F03] += amount*col[0]; fM[F13] += amount*col[1]; fM[F23] += amount*col[2];
359}
360
361////////////////////////////////////////////////////////////////////////////////
362/// General move in local-frame.
363
365{
366 fM[F03] += x*fM[0] + y*fM[4] + z*fM[8];
367 fM[F13] += x*fM[1] + y*fM[5] + z*fM[9];
368 fM[F23] += x*fM[2] + y*fM[6] + z*fM[10];
369}
370
371////////////////////////////////////////////////////////////////////////////////
372/// Rotate in local frame. Does optimised version of MultRight.
373
375{
376 if(i1 == i2) return;
377 // Algorithm: TEveTrans a; a.SetupRotation(i1, i2, amount); MultRight(a);
378 // Optimized version:
379 const Double_t cos = TMath::Cos(amount), sin = TMath::Sin(amount);
380 Double_t b1, b2;
381 Double_t* row = fM;
382 --i1 <<= 2; --i2 <<= 2; // column major
383 for (int r=0; r<4; ++r, ++row) {
384 b1 = cos*row[i1] + sin*row[i2];
385 b2 = cos*row[i2] - sin*row[i1];
386 row[i1] = b1; row[i2] = b2;
387 }
388 fAsOK = kFALSE;
389}
390
391////////////////////////////////////////////////////////////////////////////////
392/// Move in parent-frame along axis index ai.
393
395{
396 fM[F03 + --ai] += amount;
397}
398
399////////////////////////////////////////////////////////////////////////////////
400/// General move in parent-frame.
401
403{
404 fM[F03] += x;
405 fM[F13] += y;
406 fM[F23] += z;
407}
408
409////////////////////////////////////////////////////////////////////////////////
410/// Rotate in parent frame. Does optimised version of MultLeft.
411
413{
414 if(i1 == i2) return;
415 // Algorithm: TEveTrans a; a.SetupRotation(i1, i2, amount); MultLeft(a);
416
417 // Optimized version:
418 const Double_t cos = TMath::Cos(amount), sin = TMath::Sin(amount);
419 Double_t b1, b2;
420 Double_t* col = fM;
421 --i1; --i2;
422 for(int c=0; c<4; ++c, col+=4) {
423 b1 = cos*col[i1] - sin*col[i2];
424 b2 = cos*col[i2] + sin*col[i1];
425 col[i1] = b1; col[i2] = b2;
426 }
427 fAsOK = kFALSE;
428}
429
430////////////////////////////////////////////////////////////////////////////////
431/// Move in a's coord-system along axis-index ai.
432
433void TEveTrans::Move(const TEveTrans& a, Int_t ai, Double_t amount)
434{
435 const Double_t* vec = a.fM + 4*--ai;
436 fM[F03] += amount*vec[0];
437 fM[F13] += amount*vec[1];
438 fM[F23] += amount*vec[2];
439}
440
441////////////////////////////////////////////////////////////////////////////////
442/// General move in a's coord-system.
443
445{
446 const Double_t* m = a.fM;
447 fM[F03] += x*m[F00] + y*m[F01] + z*m[F02];
448 fM[F13] += x*m[F10] + y*m[F11] + z*m[F12];
449 fM[F23] += x*m[F20] + y*m[F21] + z*m[F22];
450}
451
452////////////////////////////////////////////////////////////////////////////////
453/// Rotate in a's coord-system, rotating base vector with index i1
454/// into i2.
455
456void TEveTrans::Rotate(const TEveTrans& a, Int_t i1, Int_t i2, Double_t amount)
457{
458 if(i1 == i2) return;
459 TEveTrans x(a);
460 x.Invert();
461 MultLeft(x);
462 RotatePF(i1, i2, amount);
463 MultLeft(a);
464 fAsOK = kFALSE;
465}
466
467////////////////////////////////////////////////////////////////////////////////
468/// Set base-vector with index b.
469
471{
472 Double_t* col = fM + 4*--b;
473 col[0] = x; col[1] = y; col[2] = z;
474 fAsOK = kFALSE;
475}
476
477////////////////////////////////////////////////////////////////////////////////
478/// Set base-vector with index b.
479
481{
482 Double_t* col = fM + 4*--b;
483 v.GetXYZ(col);
484 fAsOK = kFALSE;
485}
486
487////////////////////////////////////////////////////////////////////////////////
488/// Get base-vector with index b.
489
491{
492 return TVector3(&fM[4*--b]);
493}
494
496{
497 // Get base-vector with index b.
498
499 const Double_t* col = fM + 4*--b;
500 v.SetXYZ(col[0], col[1], col[2]);
501}
502
503////////////////////////////////////////////////////////////////////////////////
504/// Set position (base-vec 4).
505
507{
508 fM[F03] = x; fM[F13] = y; fM[F23] = z;
509}
510
512{
513 // Set position (base-vec 4).
514 fM[F03] = x[0]; fM[F13] = x[1]; fM[F23] = x[2];
515}
516
518{
519 // Set position (base-vec 4).
520 fM[F03] = x[0]; fM[F13] = x[1]; fM[F23] = x[2];
521}
522
524{
525 // Set position (base-vec 4).
526 const Double_t* m = t.fM;
527 fM[F03] = m[F03]; fM[F13] = m[F13]; fM[F23] = m[F23];
528}
529
530////////////////////////////////////////////////////////////////////////////////
531/// Get position (base-vec 4).
532
534{
535 x = fM[F03]; y = fM[F13]; z = fM[F23];
536}
537
539{
540 // Get position (base-vec 4).
541 x[0] = fM[F03]; x[1] = fM[F13]; x[2] = fM[F23];
542}
543
545{
546 // Get position (base-vec 4).
547 x[0] = fM[F03]; x[1] = fM[F13]; x[2] = fM[F23];
548}
549
551{
552 // Get position (base-vec 4).
553 v.SetXYZ(fM[F03], fM[F13], fM[F23]);
554}
555
557{
558 // Get position (base-vec 4).
559 return TVector3(fM[F03], fM[F13], fM[F23]);
560}
561
562namespace
563{
564inline void clamp_angle(Float_t& a)
565{
566 while(a < -TMath::TwoPi()) a += TMath::TwoPi();
567 while(a > TMath::TwoPi()) a -= TMath::TwoPi();
568}
569}
570
572{
573 // Sets Rotation part as given by angles:
574 // a1 around z, -a2 around y, a3 around x.
575
576 clamp_angle(a1); clamp_angle(a2); clamp_angle(a3);
577
578 Double_t a, b, c, d, e, f;
579 a = TMath::Cos(a3); b = TMath::Sin(a3);
580 c = TMath::Cos(a2); d = TMath::Sin(a2); // should be -sin(a2) for positive direction
581 e = TMath::Cos(a1); f = TMath::Sin(a1);
582 Double_t ad = a*d, bd = b*d;
583
584 fM[F00] = c*e; fM[F01] = -bd*e - a*f; fM[F02] = -ad*e + b*f;
585 fM[F10] = c*f; fM[F11] = -bd*f + a*e; fM[F12] = -ad*f - b*e;
586 fM[F20] = d; fM[F21] = b*c; fM[F22] = a*c;
587
588 fA1 = a1; fA2 = a2; fA3 = a3;
589 fAsOK = kTRUE;
590}
591
592////////////////////////////////////////////////////////////////////////////////
593/// Sets Rotation part as given by angles a1, a1, a3 and pattern pat.
594/// Pattern consists of "XxYyZz" characters.
595/// eg: x means rotate about x axis, X means rotate in negative direction
596/// xYz -> R_x(a3) * R_y(-a2) * R_z(a1); (standard Gled representation)
597/// Note that angles and pattern elements have inverted order!
598///
599/// Implements Eulerian/Cardanian angles in a uniform way.
600
602 const char* pat)
603{
604 int n = strspn(pat, "XxYyZz"); if(n > 3) n = 3;
605 // Build Trans ... assign ...
606 Float_t a[] = { a3, a2, a1 };
607 UnitRot();
608 for(int i=0; i<n; i++) {
609 if(isupper(pat[i])) a[i] = -a[i];
610 switch(pat[i]) {
611 case 'x': case 'X': RotateLF(2, 3, a[i]); break;
612 case 'y': case 'Y': RotateLF(3, 1, a[i]); break;
613 case 'z': case 'Z': RotateLF(1, 2, a[i]); break;
614 }
615 }
616 fAsOK = kFALSE;
617}
618
619////////////////////////////////////////////////////////////////////////////////
620/// Get Cardan rotation angles (pattern xYz above).
621
623{
624 if(!fAsOK) {
625 Double_t sx, sy, sz;
626 GetScale(sx, sy, sz);
627 Double_t d = fM[F20]/sx;
628 if(d>1) d=1; else if(d<-1) d=-1; // Fix numerical errors
629 fA2 = TMath::ASin(d);
630 Double_t cos = TMath::Cos(fA2);
631 if(TMath::Abs(cos) > 8.7e-6) {
632 fA1 = TMath::ATan2(fM[F10], fM[F00]);
633 fA3 = TMath::ATan2(fM[F21]/sy, fM[F22]/sz);
634 } else {
635 fA1 = TMath::ATan2(fM[F10]/sx, fM[F11]/sy);
636 fA3 = 0;
637 }
638 fAsOK = kTRUE;
639 }
640 x[0] = fA1; x[1] = fA2; x[2] = fA3;
641}
642
643////////////////////////////////////////////////////////////////////////////////
644/// Scale matrix. Translation part untouched.
645
647{
648 fM[F00] *= sx; fM[F10] *= sx; fM[F20] *= sx;
649 fM[F01] *= sy; fM[F11] *= sy; fM[F21] *= sy;
650 fM[F02] *= sz; fM[F12] *= sz; fM[F22] *= sz;
651}
652
653////////////////////////////////////////////////////////////////////////////////
654/// Remove scaling, make all base vectors of unit length.
655
657{
658 Double_t sx, sy, sz;
659 Unscale(sx, sy, sz);
660 return (sx + sy + sz)/3;
661}
662
663////////////////////////////////////////////////////////////////////////////////
664/// Remove scaling, make all base vectors of unit length.
665
667{
668 GetScale(sx, sy, sz);
669 fM[F00] /= sx; fM[F10] /= sx; fM[F20] /= sx;
670 fM[F01] /= sy; fM[F11] /= sy; fM[F21] /= sy;
671 fM[F02] /= sz; fM[F12] /= sz; fM[F22] /= sz;
672}
673
674////////////////////////////////////////////////////////////////////////////////
675/// Deduce scales from sizes of base vectors.
676
678{
679 sx = TMath::Sqrt( fM[F00]*fM[F00] + fM[F10]*fM[F10] + fM[F20]*fM[F20] );
680 sy = TMath::Sqrt( fM[F01]*fM[F01] + fM[F11]*fM[F11] + fM[F21]*fM[F21] );
681 sz = TMath::Sqrt( fM[F02]*fM[F02] + fM[F12]*fM[F12] + fM[F22]*fM[F22] );
682}
683
684////////////////////////////////////////////////////////////////////////////////
685/// Set scaling.
686
688{
689 sx /= TMath::Sqrt( fM[F00]*fM[F00] + fM[F10]*fM[F10] + fM[F20]*fM[F20] );
690 sy /= TMath::Sqrt( fM[F01]*fM[F01] + fM[F11]*fM[F11] + fM[F21]*fM[F21] );
691 sz /= TMath::Sqrt( fM[F02]*fM[F02] + fM[F12]*fM[F12] + fM[F22]*fM[F22] );
692
693 fM[F00] *= sx; fM[F10] *= sx; fM[F20] *= sx;
694 fM[F01] *= sy; fM[F11] *= sy; fM[F21] *= sy;
695 fM[F02] *= sz; fM[F12] *= sz; fM[F22] *= sz;
696}
697
698////////////////////////////////////////////////////////////////////////////////
699/// Change x scaling.
700
702{
703 sx /= TMath::Sqrt( fM[F00]*fM[F00] + fM[F10]*fM[F10] + fM[F20]*fM[F20] );
704 fM[F00] *= sx; fM[F10] *= sx; fM[F20] *= sx;
705}
706
707////////////////////////////////////////////////////////////////////////////////
708/// Change y scaling.
709
711{
712 sy /= TMath::Sqrt( fM[F01]*fM[F01] + fM[F11]*fM[F11] + fM[F21]*fM[F21] );
713 fM[F01] *= sy; fM[F11] *= sy; fM[F21] *= sy;
714}
715
716////////////////////////////////////////////////////////////////////////////////
717/// Change z scaling.
718
720{
721 sz /= TMath::Sqrt( fM[F02]*fM[F02] + fM[F12]*fM[F12] + fM[F22]*fM[F22] );
722 fM[F02] *= sz; fM[F12] *= sz; fM[F22] *= sz;
723}
724
725////////////////////////////////////////////////////////////////////////////////
726/// Multiply vector in-place.
727
729{
730 v.SetXYZ(fM[F00]*v.x() + fM[F01]*v.y() + fM[F02]*v.z() + fM[F03]*w,
731 fM[F10]*v.x() + fM[F11]*v.y() + fM[F12]*v.z() + fM[F13]*w,
732 fM[F20]*v.x() + fM[F21]*v.y() + fM[F22]*v.z() + fM[F23]*w);
733}
734
735////////////////////////////////////////////////////////////////////////////////
736/// Multiply vector in-place.
737
739{
740 Double_t r[3] = { v[0], v[1], v[2] };
741 v[0] = fM[F00]*r[0] + fM[F01]*r[1] + fM[F02]*r[2] + fM[F03]*w;
742 v[1] = fM[F10]*r[0] + fM[F11]*r[1] + fM[F12]*r[2] + fM[F13]*w;
743 v[2] = fM[F20]*r[0] + fM[F21]*r[1] + fM[F22]*r[2] + fM[F23]*w;
744}
745
746////////////////////////////////////////////////////////////////////////////////
747/// Multiply vector in-place.
748
750{
751 Double_t r[3] = { v[0], v[1], v[2] };
752 v[0] = fM[F00]*r[0] + fM[F01]*r[1] + fM[F02]*r[2] + fM[F03]*w;
753 v[1] = fM[F10]*r[0] + fM[F11]*r[1] + fM[F12]*r[2] + fM[F13]*w;
754 v[2] = fM[F20]*r[0] + fM[F21]*r[1] + fM[F22]*r[2] + fM[F23]*w;
755}
756
757////////////////////////////////////////////////////////////////////////////////
758/// Multiply vector and return it.
759
761{
762 return TVector3(fM[F00]*v.x() + fM[F01]*v.y() + fM[F02]*v.z() + fM[F03]*w,
763 fM[F10]*v.x() + fM[F11]*v.y() + fM[F12]*v.z() + fM[F13]*w,
764 fM[F20]*v.x() + fM[F21]*v.y() + fM[F22]*v.z() + fM[F23]*w);
765}
766
767////////////////////////////////////////////////////////////////////////////////
768/// Multiply vector and fill output array vout.
769
770void TEveTrans::Multiply(const Double_t *vin, Double_t* vout, Double_t w) const
771{
772 vout[0] = fM[F00]*vin[0] + fM[F01]*vin[1] + fM[F02]*vin[2] + fM[F03]*w;
773 vout[1] = fM[F10]*vin[0] + fM[F11]*vin[1] + fM[F12]*vin[2] + fM[F13]*w;
774 vout[2] = fM[F20]*vin[0] + fM[F21]*vin[1] + fM[F22]*vin[2] + fM[F23]*w;
775}
776
777////////////////////////////////////////////////////////////////////////////////
778/// Rotate vector in-place. Translation is NOT applied.
779
781{
782 v.SetXYZ(fM[F00]*v.x() + fM[F01]*v.y() + fM[F02]*v.z(),
783 fM[F10]*v.x() + fM[F11]*v.y() + fM[F12]*v.z(),
784 fM[F20]*v.x() + fM[F21]*v.y() + fM[F22]*v.z());
785}
786
787////////////////////////////////////////////////////////////////////////////////
788/// Rotate vector in-place. Translation is NOT applied.
789
791{
792 Double_t t[3] = { v[0], v[1], v[2] };
793
794 v[0] = fM[F00]*t[0] + fM[F01]*t[1] + fM[F02]*t[2];
795 v[1] = fM[F10]*t[0] + fM[F11]*t[1] + fM[F12]*t[2];
796 v[2] = fM[F20]*t[0] + fM[F21]*t[1] + fM[F22]*t[2];
797}
798
799////////////////////////////////////////////////////////////////////////////////
800/// Rotate vector in-place. Translation is NOT applied.
801
803{
804 Double_t t[3] = { v[0], v[1], v[2] };
805
806 v[0] = fM[F00]*t[0] + fM[F01]*t[1] + fM[F02]*t[2];
807 v[1] = fM[F10]*t[0] + fM[F11]*t[1] + fM[F12]*t[2];
808 v[2] = fM[F20]*t[0] + fM[F21]*t[1] + fM[F22]*t[2];
809}
810
811////////////////////////////////////////////////////////////////////////////////
812/// Rotate vector and return the rotated vector. Translation is NOT applied.
813
815{
816 return TVector3(fM[F00]*v.x() + fM[F01]*v.y() + fM[F02]*v.z(),
817 fM[F10]*v.x() + fM[F11]*v.y() + fM[F12]*v.z(),
818 fM[F20]*v.x() + fM[F21]*v.y() + fM[F22]*v.z());
819}
820
821////////////////////////////////////////////////////////////////////////////////
822/// Norm 3-vector in column col.
823
825{
826 Double_t* c = fM + 4*--col;
827 const Double_t l = TMath::Sqrt(c[0]*c[0] + c[1]*c[1] + c[2]*c[2]);
828 c[0] /= l; c[1] /= l; c[2] /= l;
829 return l;
830}
831
832////////////////////////////////////////////////////////////////////////////////
833/// Orto-norm 3-vector in column col with respect to column ref.
834
836{
837 Double_t* c = fM + 4*--col;
838 Double_t* rc = fM + 4*--ref;
839 const Double_t dp = c[0]*rc[0] + c[1]*rc[1] + c[2]*rc[2];
840 c[0] -= rc[0]*dp; c[1] -= rc[1]*dp; c[2] -= rc[2]*dp;
841 return dp;
842}
843
844////////////////////////////////////////////////////////////////////////////////
845/// Orto-norm columns 1 to 3.
846
848{
849 Norm3Column(1);
850 Orto3Column(2,1); Norm3Column(2);
851 fM[F02] = fM[F10]*fM[F21] - fM[F11]*fM[F20];
852 fM[F12] = fM[F20]*fM[F01] - fM[F21]*fM[F00];
853 fM[F22] = fM[F00]*fM[F11] - fM[F01]*fM[F10];
854 // Cross-product faster than the following.
855 // Orto3Column(3,1); Orto3Column(3,2); Norm3Column(3);
856}
857
858////////////////////////////////////////////////////////////////////////////////
859/// Invert matrix.
860/// Copied from ROOT's TMatrixFCramerInv.
861
863{
864 static const TEveException eh("TEveTrans::Invert ");
865
866 // Find all NECESSARY 2x2 dets: (18 of them)
867 const Double_t det2_12_01 = fM[F10]*fM[F21] - fM[F11]*fM[F20];
868 const Double_t det2_12_02 = fM[F10]*fM[F22] - fM[F12]*fM[F20];
869 const Double_t det2_12_03 = fM[F10]*fM[F23] - fM[F13]*fM[F20];
870 const Double_t det2_12_13 = fM[F11]*fM[F23] - fM[F13]*fM[F21];
871 const Double_t det2_12_23 = fM[F12]*fM[F23] - fM[F13]*fM[F22];
872 const Double_t det2_12_12 = fM[F11]*fM[F22] - fM[F12]*fM[F21];
873 const Double_t det2_13_01 = fM[F10]*fM[F31] - fM[F11]*fM[F30];
874 const Double_t det2_13_02 = fM[F10]*fM[F32] - fM[F12]*fM[F30];
875 const Double_t det2_13_03 = fM[F10]*fM[F33] - fM[F13]*fM[F30];
876 const Double_t det2_13_12 = fM[F11]*fM[F32] - fM[F12]*fM[F31];
877 const Double_t det2_13_13 = fM[F11]*fM[F33] - fM[F13]*fM[F31];
878 const Double_t det2_13_23 = fM[F12]*fM[F33] - fM[F13]*fM[F32];
879 const Double_t det2_23_01 = fM[F20]*fM[F31] - fM[F21]*fM[F30];
880 const Double_t det2_23_02 = fM[F20]*fM[F32] - fM[F22]*fM[F30];
881 const Double_t det2_23_03 = fM[F20]*fM[F33] - fM[F23]*fM[F30];
882 const Double_t det2_23_12 = fM[F21]*fM[F32] - fM[F22]*fM[F31];
883 const Double_t det2_23_13 = fM[F21]*fM[F33] - fM[F23]*fM[F31];
884 const Double_t det2_23_23 = fM[F22]*fM[F33] - fM[F23]*fM[F32];
885
886 // Find all NECESSARY 3x3 dets: (16 of them)
887 const Double_t det3_012_012 = fM[F00]*det2_12_12 - fM[F01]*det2_12_02 + fM[F02]*det2_12_01;
888 const Double_t det3_012_013 = fM[F00]*det2_12_13 - fM[F01]*det2_12_03 + fM[F03]*det2_12_01;
889 const Double_t det3_012_023 = fM[F00]*det2_12_23 - fM[F02]*det2_12_03 + fM[F03]*det2_12_02;
890 const Double_t det3_012_123 = fM[F01]*det2_12_23 - fM[F02]*det2_12_13 + fM[F03]*det2_12_12;
891 const Double_t det3_013_012 = fM[F00]*det2_13_12 - fM[F01]*det2_13_02 + fM[F02]*det2_13_01;
892 const Double_t det3_013_013 = fM[F00]*det2_13_13 - fM[F01]*det2_13_03 + fM[F03]*det2_13_01;
893 const Double_t det3_013_023 = fM[F00]*det2_13_23 - fM[F02]*det2_13_03 + fM[F03]*det2_13_02;
894 const Double_t det3_013_123 = fM[F01]*det2_13_23 - fM[F02]*det2_13_13 + fM[F03]*det2_13_12;
895 const Double_t det3_023_012 = fM[F00]*det2_23_12 - fM[F01]*det2_23_02 + fM[F02]*det2_23_01;
896 const Double_t det3_023_013 = fM[F00]*det2_23_13 - fM[F01]*det2_23_03 + fM[F03]*det2_23_01;
897 const Double_t det3_023_023 = fM[F00]*det2_23_23 - fM[F02]*det2_23_03 + fM[F03]*det2_23_02;
898 const Double_t det3_023_123 = fM[F01]*det2_23_23 - fM[F02]*det2_23_13 + fM[F03]*det2_23_12;
899 const Double_t det3_123_012 = fM[F10]*det2_23_12 - fM[F11]*det2_23_02 + fM[F12]*det2_23_01;
900 const Double_t det3_123_013 = fM[F10]*det2_23_13 - fM[F11]*det2_23_03 + fM[F13]*det2_23_01;
901 const Double_t det3_123_023 = fM[F10]*det2_23_23 - fM[F12]*det2_23_03 + fM[F13]*det2_23_02;
902 const Double_t det3_123_123 = fM[F11]*det2_23_23 - fM[F12]*det2_23_13 + fM[F13]*det2_23_12;
903
904 // Find the 4x4 det:
905 const Double_t det = fM[F00]*det3_123_123 - fM[F01]*det3_123_023 +
906 fM[F02]*det3_123_013 - fM[F03]*det3_123_012;
907
908 if(det == 0) {
909 throw(eh + "matrix is singular.");
910 }
911
912 const Double_t oneOverDet = 1.0/det;
913 const Double_t mn1OverDet = - oneOverDet;
914
915 fM[F00] = det3_123_123 * oneOverDet;
916 fM[F01] = det3_023_123 * mn1OverDet;
917 fM[F02] = det3_013_123 * oneOverDet;
918 fM[F03] = det3_012_123 * mn1OverDet;
919
920 fM[F10] = det3_123_023 * mn1OverDet;
921 fM[F11] = det3_023_023 * oneOverDet;
922 fM[F12] = det3_013_023 * mn1OverDet;
923 fM[F13] = det3_012_023 * oneOverDet;
924
925 fM[F20] = det3_123_013 * oneOverDet;
926 fM[F21] = det3_023_013 * mn1OverDet;
927 fM[F22] = det3_013_013 * oneOverDet;
928 fM[F23] = det3_012_013 * mn1OverDet;
929
930 fM[F30] = det3_123_012 * mn1OverDet;
931 fM[F31] = det3_023_012 * oneOverDet;
932 fM[F32] = det3_013_012 * mn1OverDet;
933 fM[F33] = det3_012_012 * oneOverDet;
934
935 fAsOK = kFALSE;
936 return det;
937}
938
939////////////////////////////////////////////////////////////////////////////////
940/// Stream an object of class TEveTrans.
941
942void TEveTrans::Streamer(TBuffer &R__b)
943{
944 if (R__b.IsReading()) {
945 TEveTrans::Class()->ReadBuffer(R__b, this);
946 fAsOK = kFALSE;
947 } else {
948 TEveTrans::Class()->WriteBuffer(R__b, this);
949 }
950}
951
952////////////////////////////////////////////////////////////////////////////////
953/// Print in reasonable format.
954
955void TEveTrans::Print(Option_t* /*option*/) const
956{
957 const Double_t* row = fM;
958 for(Int_t i=0; i<4; ++i, ++row)
959 printf("%8.3f %8.3f %8.3f | %8.3f\n", row[0], row[4], row[8], row[12]);
960}
961
962#include <iomanip>
963
964////////////////////////////////////////////////////////////////////////////////
965/// Print to std::ostream.
966
967std::ostream& operator<<(std::ostream& s, const TEveTrans& t)
968{
969 s.setf(std::ios::fixed, std::ios::floatfield);
970 s.precision(3);
971 for(Int_t i=1; i<=4; i++)
972 for(Int_t j=1; j<=4; j++)
973 s << t(i,j) << ((j==4) ? "\n" : "\t");
974 return s;
975}
976
977#include "TGeoMatrix.h"
978#include "TBuffer3D.h"
979
981{
982 // Initialize from array.
983
985 memcpy(fM, carr, 16*sizeof(Double_t));
986 fAsOK = kFALSE;
987}
988
989////////////////////////////////////////////////////////////////////////////////
990/// Initialize from TGeoMatrix.
991
993{
995 const Double_t *r = mat.GetRotationMatrix();
996 const Double_t *t = mat.GetTranslation();
997 Double_t *m = fM;
998 if (mat.IsScale())
999 {
1000 const Double_t *s = mat.GetScale();
1001 m[0] = r[0]*s[0]; m[1] = r[3]*s[0]; m[2] = r[6]*s[0]; m[3] = 0;
1002 m[4] = r[1]*s[1]; m[5] = r[4]*s[1]; m[6] = r[7]*s[1]; m[7] = 0;
1003 m[8] = r[2]*s[2]; m[9] = r[5]*s[2]; m[10] = r[8]*s[2]; m[11] = 0;
1004 m[12] = t[0]; m[13] = t[1]; m[14] = t[2]; m[15] = 1;
1005 }
1006 else
1007 {
1008 m[0] = r[0]; m[1] = r[3]; m[2] = r[6]; m[3] = 0;
1009 m[4] = r[1]; m[5] = r[4]; m[6] = r[7]; m[7] = 0;
1010 m[8] = r[2]; m[9] = r[5]; m[10] = r[8]; m[11] = 0;
1011 m[12] = t[0]; m[13] = t[1]; m[14] = t[2]; m[15] = 1;
1012 }
1013 fAsOK = kFALSE;
1014}
1015
1016////////////////////////////////////////////////////////////////////////////////
1017/// Set TGeoHMatrix mat.
1018
1020{
1021 Double_t *r = mat.GetRotationMatrix();
1022 Double_t *t = mat.GetTranslation();
1023 Double_t *s = mat.GetScale();
1024 if (fUseTrans)
1025 {
1027 Double_t *m = fM;
1028 GetScale(s[0], s[1], s[2]);
1029 r[0] = m[0]/s[0]; r[3] = m[1]/s[0]; r[6] = m[2]/s[0]; m += 4;
1030 r[1] = m[0]/s[1]; r[4] = m[1]/s[1]; r[7] = m[2]/s[1]; m += 4;
1031 r[2] = m[0]/s[2]; r[5] = m[1]/s[2]; r[8] = m[2]/s[2]; m += 4;
1032 t[0] = m[0]; t[1] = m[1]; t[2] = m[2];
1033 }
1034 else
1035 {
1037 r[0] = 1; r[3] = 0; r[6] = 0;
1038 r[1] = 0; r[4] = 1; r[7] = 0;
1039 r[2] = 0; r[5] = 0; r[8] = 1;
1040 s[0] = s[1] = s[2] = 1;
1041 t[0] = t[1] = t[2] = 0;
1042 }
1043}
1044
1045////////////////////////////////////////////////////////////////////////////////
1046/// Fill transformation part TBuffer3D core section.
1047
1049{
1050 buff.fLocalFrame = fUseTrans;
1051 if (fUseTrans) {
1052 // In phys-shape ctor the rotation part is transposed, due to
1053 // TGeo's convention for rotation matrix. So we have to transpose
1054 // it here, also.
1055 Double_t *m = buff.fLocalMaster;
1056 m[0] = fM[0]; m[1] = fM[4]; m[2] = fM[8]; m[3] = fM[3];
1057 m[4] = fM[1]; m[5] = fM[5]; m[6] = fM[9]; m[7] = fM[7];
1058 m[8] = fM[2]; m[9] = fM[6]; m[10] = fM[10]; m[11] = fM[11];
1059 m[12] = fM[12]; m[13] = fM[13]; m[14] = fM[14]; m[15] = fM[15];
1060 // Otherwise this would do:
1061 // memcpy(buff.fLocalMaster, fM, 16*sizeof(Double_t));
1062 }
1063}
1064
1065////////////////////////////////////////////////////////////////////////////////
1066/// Test if the transformation is a scale.
1067/// To be used by ROOT TGLObject descendants that potentially need to
1068/// use GL_NORMALIZE.
1069/// The low/high limits are expected to be squares of actual limits.
1070///
1071/// Ideally this should be done by the TGLViewer [but is not].
1072
1074{
1075 if (!fUseTrans) return kFALSE;
1076 Double_t s;
1077 s = fM[F00]*fM[F00] + fM[F10]*fM[F10] + fM[F20]*fM[F20];
1078 if (s < low || s > high) return kTRUE;
1079 s = fM[F01]*fM[F01] + fM[F11]*fM[F11] + fM[F21]*fM[F21];
1080 if (s < low || s > high) return kTRUE;
1081 s = fM[F02]*fM[F02] + fM[F12]*fM[F12] + fM[F22]*fM[F22];
1082 if (s < low || s > high) return kTRUE;
1083 return kFALSE;
1084}
ROOT::R::TRInterface & r
Definition Object.C:4
#define d(i)
Definition RSha256.hxx:102
#define b(i)
Definition RSha256.hxx:100
#define f(i)
Definition RSha256.hxx:104
#define c(i)
Definition RSha256.hxx:101
#define a(i)
Definition RSha256.hxx:99
#define h(i)
Definition RSha256.hxx:106
#define e(i)
Definition RSha256.hxx:103
int Int_t
Definition RtypesCore.h:45
const Bool_t kFALSE
Definition RtypesCore.h:101
double Double_t
Definition RtypesCore.h:59
float Float_t
Definition RtypesCore.h:57
const Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:364
TBuffer & operator<<(TBuffer &buf, const Tmpl *obj)
Definition TBuffer.h:399
#define F01
Definition TEveTrans.cxx:23
#define F22
Definition TEveTrans.cxx:34
#define F00
Definition TEveTrans.cxx:22
#define F02
Definition TEveTrans.cxx:24
#define F31
Definition TEveTrans.cxx:38
#define F32
Definition TEveTrans.cxx:39
#define F21
Definition TEveTrans.cxx:33
#define F03
Definition TEveTrans.cxx:25
#define F30
Definition TEveTrans.cxx:37
#define F11
Definition TEveTrans.cxx:28
#define F10
Definition TEveTrans.cxx:27
#define F33
Definition TEveTrans.cxx:40
#define F20
Definition TEveTrans.cxx:32
#define F12
Definition TEveTrans.cxx:29
#define F23
Definition TEveTrans.cxx:35
#define F13
Definition TEveTrans.cxx:30
Generic 3D primitive description class.
Definition TBuffer3D.h:18
Double_t fLocalMaster[16]
Definition TBuffer3D.h:92
Bool_t fLocalFrame
Definition TBuffer3D.h:90
Buffer base class used for serializing objects.
Definition TBuffer.h:43
Bool_t IsReading() const
Definition TBuffer.h:86
Exception class thrown by TEve classes and macros.
Definition TEveUtil.h:102
TEveTrans is a 4x4 transformation matrix for homogeneous coordinates stored internally in a column-ma...
Definition TEveTrans.h:27
void SetGeoHMatrix(TGeoHMatrix &mat)
Set TGeoHMatrix mat.
void OrtoNorm3()
Orto-norm columns 1 to 3.
void MultLeft(const TEveTrans &t)
Multiply from left: this = t * this.
void UnitRot()
Reset rotation part of the matrix to unity.
Bool_t fAsOK
Definition TEveTrans.h:37
Bool_t IsScale(Double_t low=0.9, Double_t high=1.1) const
Test if the transformation is a scale.
void SetBaseVec(Int_t b, Double_t x, Double_t y, Double_t z)
Set base-vector with index b.
Double_t Orto3Column(Int_t col, Int_t ref)
Orto-norm 3-vector in column col with respect to column ref.
Float_t fA3
Definition TEveTrans.h:36
void MoveLF(Int_t ai, Double_t amount)
Move in local-frame along axis with index ai.
Float_t fA2
Definition TEveTrans.h:35
TEveTrans operator*(const TEveTrans &t)
Copy, multiply from right and return product.
TEveTrans()
Default constructor.
Definition TEveTrans.cxx:73
void Move(const TEveTrans &a, Int_t ai, Double_t amount)
Move in a's coord-system along axis-index ai.
void SetFromArray(const Double_t arr[16])
Set matrix from Double_t array.
Bool_t fUseTrans
Definition TEveTrans.h:40
void Scale(Double_t sx, Double_t sy, Double_t sz)
Scale matrix. Translation part untouched.
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.
void MultRight(const TEveTrans &t)
Multiply from right: this = this * t.
void RotateIP(TVector3 &v) const
Rotate vector in-place. Translation is NOT applied.
TVector3 GetBaseVec(Int_t b) const
Get base-vector with index b.
TVector3 Multiply(const TVector3 &v, Double_t w=1) const
Multiply vector and return it.
void Move3(const TEveTrans &a, Double_t x, Double_t y, Double_t z)
General move in a's coord-system.
void RotatePF(Int_t i1, Int_t i2, Double_t amount)
Rotate in parent frame. Does optimised version of MultLeft.
void SetScale(Double_t sx, Double_t sy, Double_t sz)
Set scaling.
void SetRotByAngles(Float_t a1, Float_t a2, Float_t a3)
void SetScaleX(Double_t sx)
Change x scaling.
void RotateLF(Int_t i1, Int_t i2, Double_t amount)
Rotate in local frame. Does optimised version of MultRight.
void UnitTrans()
Reset matrix to unity.
void SetScaleY(Double_t sy)
Change y scaling.
Double_t Norm3Column(Int_t col)
Norm 3-vector in column col.
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.
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...
void MovePF(Int_t ai, Double_t amount)
Move in parent-frame along axis index ai.
Double_t Invert()
Invert matrix.
virtual void Print(Option_t *option="") const
Print in reasonable format.
Float_t fA1
Definition TEveTrans.h:34
void Move3LF(Double_t x, Double_t y, Double_t z)
General move in local-frame.
TVector3 GetPos() const
Double32_t fM[16]
Definition TEveTrans.h:32
void TransposeRotationPart()
Transpose 3x3 rotation sub-matrix.
void SetupRotation(Int_t i, Int_t j, Double_t f)
Setup the matrix as an elementary rotation.
void SetBuffer3D(TBuffer3D &buff)
Fill transformation part TBuffer3D core section.
void GetScale(Double_t &sx, Double_t &sy, Double_t &sz) const
Deduce scales from sizes of base vectors.
void MultiplyIP(TVector3 &v, Double_t w=1) const
Multiply vector in-place.
Double_t Unscale()
Remove scaling, make all base vectors of unit length.
void SetFrom(Double_t *carr)
void SetTrans(const TEveTrans &t, Bool_t copyAngles=kTRUE)
Set matrix from another,.
void Move3PF(Double_t x, Double_t y, Double_t z)
General move in parent-frame.
void SetScaleZ(Double_t sz)
Change z scaling.
void GetRotAngles(Float_t *x) const
Get Cardan rotation angles (pattern xYz above).
void SetPos(Double_t x, Double_t y, Double_t z)
Set position (base-vec 4).
Double_t CM(Int_t i, Int_t j) const
Definition TEveTrans.h:103
void ZeroTrans(Double_t w=1.0)
Reset matrix to zero, only the perspective scaling is set to w (1 by default).
TEveVectorT Cross(const TEveVectorT &a) const
Definition TEveVector.h:175
TT Dot(const TEveVectorT &a) const
Definition TEveVector.h:168
TEveVectorT & Sub(const TEveVectorT &a, const TEveVectorT &b)
Definition TEveVector.h:186
TT Mag2() const
Definition TEveVector.h:98
Matrix class used for computing global transformations Should NOT be used for node definition.
Definition TGeoMatrix.h:421
virtual const Double_t * GetScale() const
Definition TGeoMatrix.h:469
virtual const Double_t * GetTranslation() const
Definition TGeoMatrix.h:467
virtual const Double_t * GetRotationMatrix() const
Definition TGeoMatrix.h:468
Geometrical transformation package.
Definition TGeoMatrix.h:41
Bool_t IsScale() const
Definition TGeoMatrix.h:70
virtual const Double_t * GetTranslation() const =0
virtual const Double_t * GetScale() const =0
virtual const Double_t * GetRotationMatrix() const =0
Mother of all ROOT objects.
Definition TObject.h:41
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:766
void ResetBit(UInt_t f)
Definition TObject.h:200
void SetXYZ(Double_t x, Double_t y, Double_t z)
Definition TVector3.h:227
return c1
Definition legend1.C:41
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
return c2
Definition legend2.C:14
return c3
Definition legend3.C:15
Double_t ASin(Double_t)
Definition TMath.h:613
Double_t ATan2(Double_t y, Double_t x)
Definition TMath.h:629
Double_t Sqrt(Double_t x)
Definition TMath.h:641
Double_t Cos(Double_t)
Definition TMath.h:593
Double_t Sin(Double_t)
Definition TMath.h:589
Short_t Abs(Short_t d)
Definition TMathBase.h:120
constexpr Double_t TwoPi()
Definition TMath.h:44
auto * m
Definition textangle.C:8
auto * l
Definition textangle.C:4