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