Logo ROOT   6.10/00
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TGLUtil.h
Go to the documentation of this file.
1 // @(#)root/gl:$Id$
2 // Author: Richard Maunder 25/05/2005
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2004, 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 #ifndef ROOT_TGLUtil
13 #define ROOT_TGLUtil
14 
15 #include "Rtypes.h"
16 #include "TError.h"
17 
18 #include <vector>
19 #include <cmath>
20 #include <cassert>
21 
22 class TString;
23 class TGLBoundingBox;
24 class TGLCamera;
25 
26 class TAttMarker;
27 class TAttLine;
28 
29 class GLUtesselator;
30 
31 namespace Rgl
32 {
33  enum EOverlap
34  {
35  kInside = 0,
38  };
39 }
40 
42 {
47 };
48 
50 {
62 };
63 
64 
65 // TODO: Split these into own h/cxx files - too long now!
66 
67 //////////////////////////////////////////////////////////////////////////
68 // //
69 // TGLVertex3 //
70 // //
71 // 3 component (x/y/z) vertex class //
72 // //
73 // This is part of collection of utility classes for GL in TGLUtil.h/cxx//
74 // These provide const and non-const accessors Arr() / CArr() to a GL //
75 // compatible internal field - so can be used directly with OpenGL C API//
76 // calls. They are not intended to be fully featured just provide //
77 // minimum required. //
78 //////////////////////////////////////////////////////////////////////////
79 
80 class TGLVector3; // Forward declare for Shift()
81 
83 {
84 protected:
85  // Fields
86  Bool_t ValidIndex(UInt_t index) const { return (index < 3); }
88 
89 public:
90  TGLVertex3();
93  TGLVertex3(const TGLVertex3 & other);
94  virtual ~TGLVertex3();
95 
96  Bool_t operator == (const TGLVertex3 & rhs) const;
97  TGLVertex3 & operator = (const TGLVertex3 & rhs);
99  TGLVertex3 operator - () const;
100  const TGLVertex3 & operator -= (const TGLVector3 & val);
101  const TGLVertex3 & operator += (const TGLVector3 & val);
102 
103  // Manipulators
104  void Fill(Double_t val);
105  void Set(Double_t x, Double_t y, Double_t z);
106  void Set(const Double_t* xyz);
107  void Set(const TGLVertex3 & other);
108  void Shift(TGLVector3 & shift);
109  void Shift(Double_t xDelta, Double_t yDelta, Double_t zDelta);
110  void Negate();
111 
112  void Minimum(const TGLVertex3 & other);
113  void Maximum(const TGLVertex3 & other);
114 
115  // Accessors
116  Double_t & operator [] (Int_t index);
117  const Double_t & operator [] (Int_t index) const;
118  Double_t X() const { return fVals[0]; }
119  Double_t & X() { return fVals[0]; }
120  Double_t Y() const { return fVals[1]; }
121  Double_t & Y() { return fVals[1]; }
122  Double_t Z() const { return fVals[2]; }
123  Double_t & Z() { return fVals[2]; }
124 
125  const Double_t * CArr() const { return fVals; }
126  Double_t * Arr() { return fVals; }
127 
128  void Dump() const;
129 
130  ClassDef(TGLVertex3,1); // GL 3 component vertex helper/wrapper class
131 };
132 
133 //______________________________________________________________________________
135 {
136  return TGLVertex3(f*v.X(), f*v.Y(), f*v.Z());
137 }
138 
139 //______________________________________________________________________________
140 inline void TGLVertex3::Negate()
141 {
142  fVals[0] = -fVals[0];
143  fVals[1] = -fVals[1];
144  fVals[2] = -fVals[2];
145 }
146 
147 //______________________________________________________________________________
148 inline Bool_t TGLVertex3::operator == (const TGLVertex3 & rhs) const
149 {
150  return (fVals[0] == rhs.fVals[0] && fVals[1] == rhs.fVals[1] && fVals[2] == rhs.fVals[2]);
151 }
152 
153 //______________________________________________________________________________
155 {
156  // Check for self-assignment
157  if (this != &rhs) {
158  Set(rhs);
159  }
160  return *this;
161 }
162 
163 // operator -= & operator += inline needs to be defered until full TGLVector3 definition
164 
165 //______________________________________________________________________________
167 {
168  return TGLVertex3(-fVals[0], -fVals[1], -fVals[2]);
169 }
170 
171 //______________________________________________________________________________
173 {
174  fVals[0] *= f;
175  fVals[1] *= f;
176  fVals[2] *= f;
177  return *this;
178 }
179 
180 //______________________________________________________________________________
182 {
183  /*if (!ValidIndex(index)) {
184  assert(kFALSE);
185  return fVals[0];
186  } else {*/
187  return fVals[index];
188  //}
189 }
190 
191 //______________________________________________________________________________
192 inline const Double_t& TGLVertex3::operator [] (Int_t index) const
193 {
194  /*if (!ValidIndex(index)) {
195  assert(kFALSE);
196  return fVals[0];
197  } else {*/
198  return fVals[index];
199  //}
200 }
201 
202 //______________________________________________________________________________
203 inline void TGLVertex3::Fill(Double_t val)
204 {
205  Set(val,val,val);
206 }
207 
208 //______________________________________________________________________________
210 {
211  fVals[0]=x;
212  fVals[1]=y;
213  fVals[2]=z;
214 }
215 
216 //______________________________________________________________________________
217 inline void TGLVertex3::Set(const Double_t* xyz)
218 {
219  fVals[0]=xyz[0];
220  fVals[1]=xyz[1];
221  fVals[2]=xyz[2];
222 }
223 
224 //______________________________________________________________________________
225 inline void TGLVertex3::Set(const TGLVertex3 & other)
226 {
227  fVals[0]=other.fVals[0];
228  fVals[1]=other.fVals[1];
229  fVals[2]=other.fVals[2];
230 }
231 
232 
233 //////////////////////////////////////////////////////////////////////////
234 // //
235 // TGLVector3 //
236 // //
237 // 3 component (x/y/z) vector class //
238 // //
239 // This is part of collection of utility classes for GL in TGLUtil.h/cxx//
240 // These provide const and non-const accessors Arr() / CArr() to a GL //
241 // compatible internal field - so can be used directly with OpenGL C API//
242 // calls. They are not intended to be fully featured just provide //
243 // minimum required. //
244 //////////////////////////////////////////////////////////////////////////
245 
246 class TGLVector3 : public TGLVertex3
247 {
248 public:
249  TGLVector3();
251  TGLVector3(const Double_t *src);
252  TGLVector3(const TGLVector3 & other);
253  virtual ~TGLVector3();
254 
256  { fVals[0] = v[0]; fVals[1] = v[1]; fVals[2] = v[2]; return *this; }
257 
259  TGLVector3 operator - () const;
260 
261  Double_t Mag() const;
262  void Normalise();
263 
264  ClassDef(TGLVector3,1); // GL 3 component vector helper/wrapper class
265 };
266 
267 // Inline for TGLVertex3 requiring full TGLVector definition
268 //______________________________________________________________________________
269 inline const TGLVertex3 & TGLVertex3::operator -= (const TGLVector3 & vec)
270 {
271  fVals[0] -= vec[0]; fVals[1] -= vec[1]; fVals[2] -= vec[2];
272  return *this;
273 }
274 
275 // Inline for TGLVertex3 requiring full TGLVector definition
276 //______________________________________________________________________________
277 inline const TGLVertex3 & TGLVertex3::operator += (const TGLVector3 & vec)
278 {
279  fVals[0] += vec[0]; fVals[1] += vec[1]; fVals[2] += vec[2];
280  return *this;
281 }
282 
283 //______________________________________________________________________________
285 {
286  fVals[0] /= val;
287  fVals[1] /= val;
288  fVals[2] /= val;
289  return *this;
290 }
291 
292 //______________________________________________________________________________
294 {
295  return TGLVector3(-fVals[0], -fVals[1], -fVals[2]);
296 }
297 
298 //______________________________________________________________________________
299 inline Double_t TGLVector3::Mag() const
300 {
301  return std::sqrt(fVals[0]*fVals[0] + fVals[1]*fVals[1] + fVals[2]*fVals[2]);
302 }
303 
304 //______________________________________________________________________________
306 {
307  Double_t mag = Mag();
308  if ( mag == 0.0 ) {
309  Error("TGLVector3::Normalise", "vector has zero magnitude");
310  return;
311  }
312  fVals[0] /= mag;
313  fVals[1] /= mag;
314  fVals[2] /= mag;
315 }
316 
317 //______________________________________________________________________________
318 inline Double_t Dot(const TGLVector3 & v1, const TGLVector3 & v2)
319 {
320  return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2];
321 }
322 
323 //______________________________________________________________________________
324 inline TGLVector3 Cross(const TGLVector3 & v1, const TGLVector3 & v2)
325 {
326  return TGLVector3(v1[1]*v2[2] - v2[1]*v1[2],
327  v1[2]*v2[0] - v2[2]*v1[0],
328  v1[0]*v2[1] - v2[0]*v1[1]);
329 }
330 
331 //______________________________________________________________________________
332 inline const TGLVector3 operator / (const TGLVector3 & vec, Double_t val)
333 {
334  return TGLVector3(vec[0] / val, vec[1] / val, vec[2] / val);
335 }
336 
337 //______________________________________________________________________________
338 inline const TGLVector3 operator * (const TGLVector3 & vec, Double_t val)
339 {
340  return TGLVector3(vec[0] * val, vec[1] * val, vec[2] * val);
341 }
342 
343 //______________________________________________________________________________
344 // Vertex + Vector => Vertex
345 inline TGLVertex3 operator + (const TGLVertex3 & vertex1, const TGLVector3 & vertex2)
346 {
347  return TGLVertex3(vertex1[0] + vertex2[0], vertex1[1] + vertex2[1], vertex1[2] + vertex2[2]);
348 }
349 
350 //______________________________________________________________________________
351 // Vertex - Vertex => Vector
352 inline TGLVector3 operator - (const TGLVertex3 & vertex1, const TGLVertex3 & vertex2)
353 {
354  return TGLVector3(vertex1[0] - vertex2[0], vertex1[1] - vertex2[1], vertex1[2] - vertex2[2]);
355 }
356 
357 //______________________________________________________________________________
358 // Vector + Vector => Vector
359 inline TGLVector3 operator + (const TGLVector3 & vector1, const TGLVector3 & vector2)
360 {
361  return TGLVector3(vector1[0] + vector2[0], vector1[1] + vector2[1], vector1[2] + vector2[2]);
362 }
363 
364 //______________________________________________________________________________
365 // Vector - Vector => Vector
366 inline TGLVector3 operator - (const TGLVector3 & vector1, const TGLVector3 & vector2)
367 {
368  return TGLVector3(vector1[0] - vector2[0], vector1[1] - vector2[1], vector1[2] - vector2[2]);
369 }
370 
371 //______________________________________________________________________________
372 // Dot-product
373 inline Double_t operator * (const TGLVector3 & a, const TGLVector3 & b)
374 {
375  return a[0]*b[0] + a[1]*b[1] + a[2]*b[2];
376 }
377 
378 //////////////////////////////////////////////////////////////////////////
379 // //
380 // TGLLine3 //
381 // //
382 // 3D space, fixed length, line class, with direction / length 'vector',//
383 // passing through point 'vertex'. Just wraps a TGLVector3 / TGLVertex3 //
384 // pair. //
385 //////////////////////////////////////////////////////////////////////////
386 
387 class TGLLine3
388 {
389 private:
390  // Fields
391  TGLVertex3 fVertex; //! Start vertex of line
392  TGLVector3 fVector; //! Vector of line from fVertex
393 
394 public:
395  TGLLine3(const TGLVertex3 & start, const TGLVertex3 & end);
396  TGLLine3(const TGLVertex3 & start, const TGLVector3 & vector);
397  virtual ~TGLLine3();
398 
399  void Set(const TGLVertex3 & start, const TGLVertex3 & end);
400  void Set(const TGLVertex3 & start, const TGLVector3 & vector);
401 
402  // Bitwise copy constructor and = operator are fine
403 
404  // Accessors
405  const TGLVertex3 & Start() const { return fVertex; }
406  const TGLVertex3 End() const { return fVertex + fVector; }
407  const TGLVector3 & Vector() const { return fVector; }
408 
409  // Debug
410  void Draw() const;
411 
412  ClassDef(TGLLine3,0); // GL line wrapper class
413 };
414 
415 //////////////////////////////////////////////////////////////////////////
416 // //
417 // TGLRect //
418 // //
419 // Viewport (pixel base) 2D rectangle class //
420 //////////////////////////////////////////////////////////////////////////
421 
422 class TGLRect
423 {
424 private:
425  // Fields
426  Int_t fX, fY; //! Corner
427  Int_t fWidth, fHeight; //! Positive width/height
428 
429 public:
430  TGLRect();
431  TGLRect(Int_t x, Int_t y, Int_t width, Int_t height);
432  TGLRect(Int_t x, Int_t y, UInt_t width, UInt_t height);
433  virtual ~TGLRect();
434 
435  // Bitwise copy const & =op are ok at present
436 
437  // Manipulators
438  void Set(Int_t x, Int_t y, Int_t width, Int_t height);
439  void SetCorner(Int_t x, Int_t y);
440  void Offset(Int_t dX, Int_t dY);
441  void Expand(Int_t x, Int_t y);
442 
443  // Accessors
444  const Int_t* CArr() const { return &fX; }
445  Int_t* CArr() { return &fX; }
446 
447  Int_t X() const { return fX; }
448  Int_t & X() { return fX; }
449  Int_t Y() const { return fY; }
450  Int_t & Y() { return fY; }
451  Int_t Width() const { return fWidth; }
452  Int_t & Width() { return fWidth; }
453  Int_t Height() const { return fHeight; }
454  Int_t & Height() { return fHeight; }
455  Int_t CenterX() const { return fX + fWidth/2; }
456  Int_t CenterY() const { return fY + fHeight/2; }
457  Int_t Left() const { return fX; }
458  Int_t Right() const { return fX + fWidth; }
459  Int_t Top() const { return fY; }
460  Int_t Bottom() const { return fY + fHeight; }
461 
462  Int_t Diagonal() const;
463  Int_t Longest() const;
464 
465  Double_t Aspect() const;
466  Rgl::EOverlap Overlap(const TGLRect & other) const;
467 
468  ClassDef(TGLRect,0); // GL rect helper/wrapper class
469 };
470 
471 //______________________________________________________________________________
472 inline void TGLRect::Set(Int_t x, Int_t y, Int_t width, Int_t height)
473 {
474  fX = x;
475  fY = y;
476  fWidth = width;
477  fHeight = height;
478 }
479 
480 //______________________________________________________________________________
482 {
483  fX = x;
484  fY = y;
485 }
486 
487 //______________________________________________________________________________
488 inline void TGLRect::Offset(Int_t dX, Int_t dY)
489 {
490  fX += dX;
491  fY += dY;
492 }
493 
494 //______________________________________________________________________________
495 inline Int_t TGLRect::Longest() const
496 {
497  return fWidth > fHeight ? fWidth : fHeight;
498 }
499 
500 //______________________________________________________________________________
501 inline Double_t TGLRect::Aspect() const
502 {
503  // Return aspect ratio (width/height)
504  if (fHeight == 0) {
505  return 0.0;
506  } else {
507  return static_cast<Double_t>(fWidth) / static_cast<Double_t>(fHeight);
508  }
509 }
510 
511 //////////////////////////////////////////////////////////////////////////
512 // //
513 // TGLPlane //
514 // //
515 // 3D plane class - of format Ax + By + Cz + D = 0 //
516 // //
517 // This is part of collection of simple utility classes for GL only in //
518 // TGLUtil.h/cxx. These provide const and non-const accessors Arr() & //
519 // CArr() to a GL compatible internal field - so can be used directly //
520 // with OpenGL C API calls - which TVector3 etc cannot (easily). //
521 // They are not intended to be fully featured just provide minimum //
522 // required. //
523 //////////////////////////////////////////////////////////////////////////
524 
525 class TGLPlane
526 {
527 private:
528  // Fields
530 
531  // Methods
532  void Normalise();
533 
534 public:
535  TGLPlane();
536  TGLPlane(const TGLPlane & other);
538  TGLPlane(Double_t eq[4]);
539  TGLPlane(const TGLVector3 & norm, const TGLVertex3 & point);
540  TGLPlane(const TGLVertex3 & p1, const TGLVertex3 & p2, const TGLVertex3 & p3);
541  virtual ~TGLPlane();
542 
543  // Manipulators
544  void Set(const TGLPlane & other);
545  void Set(Double_t a, Double_t b, Double_t c, Double_t d);
546  void Set(Double_t eq[4]);
547  void Set(const TGLVector3 & norm, const TGLVertex3 & point);
548  void Set(const TGLVertex3 & p1, const TGLVertex3 & p2, const TGLVertex3 & p3);
549  void Negate();
550 
551  // Accessors
552  Double_t A() const { return fVals[0]; }
553  Double_t B() const { return fVals[1]; }
554  Double_t C() const { return fVals[2]; }
555  Double_t D() const { return fVals[3]; }
556 
557  TGLVector3 Norm() const { return TGLVector3( fVals[0], fVals[1], fVals[2]); }
558  Double_t DistanceTo(const TGLVertex3 & vertex) const;
559  TGLVertex3 NearestOn(const TGLVertex3 & point) const;
560 
561  // Internal data accessors - for GL API
562  const Double_t * CArr() const { return fVals; }
563  Double_t * Arr() { return fVals; }
564 
565  void Dump() const;
566 
567  ClassDef(TGLPlane,0); // GL plane helper/wrapper class
568 };
569 
570 typedef std::vector<TGLPlane> TGLPlaneSet_t;
571 typedef std::vector<TGLPlane>::iterator TGLPlaneSet_i;
572 typedef std::vector<TGLPlane>::const_iterator TGLPlaneSet_ci;
573 
574 // Some free functions for planes
575 std::pair<Bool_t, TGLLine3> Intersection(const TGLPlane & p1, const TGLPlane & p2);
576 std::pair<Bool_t, TGLVertex3> Intersection(const TGLPlane & p1, const TGLPlane & p2, const TGLPlane & p3);
577 std::pair<Bool_t, TGLVertex3> Intersection(const TGLPlane & plane, const TGLLine3 & line, Bool_t extend);
578 
579 
580 //////////////////////////////////////////////////////////////////////////
581 // //
582 // TGLMatrix //
583 // //
584 // 16 component (4x4) transform matrix - column MAJOR as per GL. //
585 // Provides limited support for adjusting the translation, scale and //
586 // rotation components. //
587 // //
588 // This is part of collection of simple utility classes for GL only in //
589 // TGLUtil.h/cxx. These provide const and non-const accessors Arr() & //
590 // CArr() to a GL compatible internal field - so can be used directly //
591 // with OpenGL C API calls - which TVector3 etc cannot (easily). //
592 // They are not intended to be fully featured just provide minimum //
593 // required. //
594 //////////////////////////////////////////////////////////////////////////
595 
597 {
598 private:
599  // Fields
600  Double_t fVals[16]; // Column MAJOR as per OGL
601 
602  // Methods
603  Bool_t ValidIndex(UInt_t index) const { return (index < 16); }
604 
605 public:
606  TGLMatrix();
608  TGLMatrix(const TGLVertex3 & translation);
609  TGLMatrix(const TGLVertex3 & origin, const TGLVector3 & zAxis, const TGLVector3 & xAxis);
610  TGLMatrix(const TGLVertex3 & origin, const TGLVector3 & zAxis);
611  TGLMatrix(const Double_t vals[16]);
612  TGLMatrix(const TGLMatrix & other);
613  virtual ~TGLMatrix();
614 
615  // Operators
616  TGLMatrix & operator =(const TGLMatrix & rhs);
617  Double_t & operator [] (Int_t index);
618  Double_t operator [] (Int_t index) const;
619 
620  void MultRight(const TGLMatrix & rhs);
621  void MultLeft (const TGLMatrix & lhs);
622  TGLMatrix & operator*=(const TGLMatrix & rhs) { MultRight(rhs); return *this; }
623 
624  // Manipulators
625  void Set(const TGLVertex3 & origin, const TGLVector3 & zAxis, const TGLVector3 & xAxis = 0);
626  void Set(const Double_t vals[16]);
627  void SetIdentity();
628 
630  void SetTranslation(const TGLVertex3 & translation);
631 
632  void Translate(const TGLVector3 & vect);
633  void MoveLF(Int_t ai, Double_t amount);
635 
636  void Scale(const TGLVector3 & scale);
637  void Rotate(const TGLVertex3 & pivot, const TGLVector3 & axis, Double_t angle);
638  void RotateLF(Int_t i1, Int_t i2, Double_t amount);
639  void RotatePF(Int_t i1, Int_t i2, Double_t amount);
640  void TransformVertex(TGLVertex3 & vertex) const;
641  void Transpose3x3();
642  Double_t Invert();
643 
644  // Accesors
645  TGLVector3 GetTranslation() const;
646  TGLVector3 GetScale() const;
647  Bool_t IsScalingForRender() const;
648 
650  void SetBaseVec(Int_t b, const TGLVector3& v);
651  void SetBaseVec(Int_t b, Double_t* x);
652 
653  TGLVector3 GetBaseVec(Int_t b) const;
654  void GetBaseVec(Int_t b, TGLVector3& v) const;
655  void GetBaseVec(Int_t b, Double_t* x) const;
656 
657  TGLVector3 Multiply(const TGLVector3& v, Double_t w=1) const;
658  TGLVector3 Rotate(const TGLVector3& v) const;
659  void MultiplyIP(TGLVector3& v, Double_t w=1) const;
660  void RotateIP(TGLVector3& v) const;
661 
662  // Internal data accessors - for GL API
663  const Double_t * CArr() const { return fVals; }
664  Double_t * Arr() { return fVals; }
665 
666  void Dump() const;
667 
668  ClassDef(TGLMatrix,1); // GL matrix helper/wrapper class
669 };
670 
671 //______________________________________________________________________________
673 {
674  // Check for self-assignment
675  if (this != &rhs) {
676  Set(rhs.fVals);
677  }
678  return *this;
679 }
680 
681 //______________________________________________________________________________
683 {
684  /*if (!ValidIndex(index)) {
685  assert(kFALSE);
686  return fVals[0];
687  } else {*/
688  return fVals[index];
689  //}
690 }
691 
692 //______________________________________________________________________________
694 {
695  /*if (!ValidIndex(index)) {
696  assert(kFALSE);
697  return fVals[0];
698  } else {*/
699  return fVals[index];
700  //}
701 }
702 
703 //______________________________________________________________________________
704 inline TGLMatrix operator * (const TGLMatrix & lhs, const TGLMatrix & rhs)
705 {
706  TGLMatrix res;
707 
708  res[ 0] = rhs[ 0] * lhs[ 0] + rhs[ 1] * lhs[ 4] + rhs[ 2] * lhs[ 8] + rhs[ 3] * lhs[12];
709  res[ 1] = rhs[ 0] * lhs[ 1] + rhs[ 1] * lhs[ 5] + rhs[ 2] * lhs[ 9] + rhs[ 3] * lhs[13];
710  res[ 2] = rhs[ 0] * lhs[ 2] + rhs[ 1] * lhs[ 6] + rhs[ 2] * lhs[10] + rhs[ 3] * lhs[14];
711  res[ 3] = rhs[ 0] * lhs[ 3] + rhs[ 1] * lhs[ 7] + rhs[ 2] * lhs[11] + rhs[ 3] * lhs[15];
712 
713  res[ 4] = rhs[ 4] * lhs[ 0] + rhs[ 5] * lhs[ 4] + rhs[ 6] * lhs[ 8] + rhs[ 7] * lhs[12];
714  res[ 5] = rhs[ 4] * lhs[ 1] + rhs[ 5] * lhs[ 5] + rhs[ 6] * lhs[ 9] + rhs[ 7] * lhs[13];
715  res[ 6] = rhs[ 4] * lhs[ 2] + rhs[ 5] * lhs[ 6] + rhs[ 6] * lhs[10] + rhs[ 7] * lhs[14];
716  res[ 7] = rhs[ 4] * lhs[ 3] + rhs[ 5] * lhs[ 7] + rhs[ 6] * lhs[11] + rhs[ 7] * lhs[15];
717 
718  res[ 8] = rhs[ 8] * lhs[ 0] + rhs[ 9] * lhs[ 4] + rhs[10] * lhs[ 8] + rhs[11] * lhs[12];
719  res[ 9] = rhs[ 8] * lhs[ 1] + rhs[ 9] * lhs[ 5] + rhs[10] * lhs[ 9] + rhs[11] * lhs[13];
720  res[10] = rhs[ 8] * lhs[ 2] + rhs[ 9] * lhs[ 6] + rhs[10] * lhs[10] + rhs[11] * lhs[14];
721  res[11] = rhs[ 8] * lhs[ 3] + rhs[ 9] * lhs[ 7] + rhs[10] * lhs[11] + rhs[11] * lhs[15];
722 
723  res[12] = rhs[12] * lhs[ 0] + rhs[13] * lhs[ 4] + rhs[14] * lhs[ 8] + rhs[15] * lhs[12];
724  res[13] = rhs[12] * lhs[ 1] + rhs[13] * lhs[ 5] + rhs[14] * lhs[ 9] + rhs[15] * lhs[13];
725  res[14] = rhs[12] * lhs[ 2] + rhs[13] * lhs[ 6] + rhs[14] * lhs[10] + rhs[15] * lhs[14];
726  res[15] = rhs[12] * lhs[ 3] + rhs[13] * lhs[ 7] + rhs[14] * lhs[11] + rhs[15] * lhs[15];
727 
728  return res;
729 }
730 
731 //______________________________________________________________________________
733 {
734  Double_t* C = fVals + 4*--b;
735  C[0] = x; C[1] = y; C[2] = z;
736 }
737 
738 //______________________________________________________________________________
740 {
741  Double_t* C = fVals + 4*--b;
742  C[0] = v[0]; C[1] = v[1]; C[2] = v[2];
743 }
744 
745 //______________________________________________________________________________
747 {
748  Double_t* C = fVals + 4*--b;
749  C[0] = x[0]; C[1] = x[1]; C[2] = x[2];
750 }
751 
752 //______________________________________________________________________________
754 {
755  return TGLVector3(&fVals[4*--b]);
756 }
757 
758 //______________________________________________________________________________
760 {
761  const Double_t* C = fVals + 4*--b;
762  v[0] = C[0]; v[1] = C[1]; v[2] = C[2];
763 }
764 
765 //______________________________________________________________________________
766 inline void TGLMatrix::GetBaseVec(Int_t b, Double_t* x) const
767 {
768  const Double_t* C = fVals + 4*--b;
769  x[0] = C[0], x[1] = C[1], x[2] = C[2];
770 }
771 
772 
773 //////////////////////////////////////////////////////////////////////////
774 //
775 // TGLColor
776 //
777 // Encapsulate color in preferred GL format - UChar_t RGBA array.
778 // Color index is also cached for easier interfacing with the
779 // traditional ROOT graphics.
780 //
781 //////////////////////////////////////////////////////////////////////////
782 
783 class TGLColor
784 {
785 protected:
787  mutable Short_t fIndex;
788 
789 public:
790  TGLColor();
791  TGLColor(Int_t r, Int_t g, Int_t b, Int_t a=255);
793  TGLColor(Color_t color_index, Char_t transparency=0);
794  virtual ~TGLColor();
795 
796  TGLColor& operator=(const TGLColor& c);
797 
798  UChar_t* Arr() { return fRGBA; }
799  const UChar_t* CArr() const { return fRGBA; }
800 
801  UChar_t GetRed() const { return fRGBA[0]; }
802  UChar_t GetGreen() const { return fRGBA[1]; }
803  UChar_t GetBlue() const { return fRGBA[2]; }
804  UChar_t GetAlpha() const { return fRGBA[3]; }
805 
806  Color_t GetColorIndex() const;
807  Char_t GetTransparency() const;
808 
809  void SetRed(Int_t v) { fRGBA[0] = v; }
810  void SetGreen(Int_t v) { fRGBA[1] = v; }
811  void SetBlue(Int_t v) { fRGBA[2] = v; }
812  void SetAlpha(Int_t v) { fRGBA[3] = v; }
813 
814  void SetColor(Int_t r, Int_t g, Int_t b, Int_t a=255);
815  void SetColor(Float_t r, Float_t g, Float_t b, Float_t a=1);
816  void SetColor(Color_t color_index);
817  void SetColor(Color_t color_index, Char_t transparency);
818  void SetTransparency(Char_t transparency);
819 
820  TString AsString() const;
821 
822  ClassDef(TGLColor, 0); // Color in preferred GL format - RGBA.
823 };
824 
825 
826 //////////////////////////////////////////////////////////////////////////
827 //
828 // TGLColorSet
829 //
830 // A collection of colors used for OpenGL rendering.
831 //
832 //////////////////////////////////////////////////////////////////////////
833 
835 {
836 protected:
841  TGLColor fSelection[5]; // Colors for shape-selection-levels
842 
843 public:
844  TGLColorSet();
845  virtual ~TGLColorSet();
846 
847  TGLColorSet& operator=(const TGLColorSet& s);
848 
851  TGLColor& Outline() { return fOutline; }
852  TGLColor& Markup() { return fMarkup; }
853  TGLColor& Selection(Int_t i) { return fSelection[i]; }
854 
855  const TGLColor& Background() const { return fBackground; }
856  const TGLColor& Foreground() const { return fForeground; }
857  const TGLColor& Outline() const { return fOutline; }
858  const TGLColor& Markup() const { return fMarkup; }
859  const TGLColor& Selection(Int_t i) const { return fSelection[i]; }
860 
861  void StdDarkBackground();
862  void StdLightBackground();
863 
864  ClassDef(TGLColorSet, 0); // Collection of colors used for GL rendering.
865 };
866 
867 //////////////////////////////////////////////////////////////////////////
868 // //
869 // TGLUtil //
870 // //
871 // Wrapper class for various misc static functions - error checking, //
872 // draw helpers etc. //
873 // //
874 //////////////////////////////////////////////////////////////////////////
875 
876 class TGLUtil
877 {
878 public:
880  {
881  public:
883  virtual ~TColorLocker() { UnlockColor(); }
884 
885  ClassDef(TColorLocker,0); // Lock/unlock color in constructor/destructor.
886  };
887 
889  {
891  public:
894 
897 
898  ClassDef(TDrawQualityModifier,0); // Set/restore draw quality in constructor/destructor.
899  };
900 
902  {
904  public:
907 
910 
911  ClassDef(TDrawQualityScaler,0); // Multiply/restore draw quality in constructor/destructor.
912  };
913 
914 private:
917 
919 
924 
928 
929  TGLUtil(const TGLUtil&); // Not implemented.
930  TGLUtil& operator=(const TGLUtil&); // Not implemented.
931 
932 public:
933  virtual ~TGLUtil() {}
934  static void InitializeIfNeeded();
935 
936  // Error checking
937  static Int_t CheckError(const char * loc);
938 
939  // Polygon tesselator for direct drawing
940  static GLUtesselator* GetDrawTesselator3fv();
941  static GLUtesselator* GetDrawTesselator4fv();
942  static GLUtesselator* GetDrawTesselator3dv();
943  static GLUtesselator* GetDrawTesselator4dv();
944 
945  // Some simple shape drawing utils
948 
949  static UInt_t GetDrawQuality();
950  static void SetDrawQuality(UInt_t dq);
951  static void ResetDrawQuality();
952  static UInt_t GetDefaultDrawQuality();
953  static void SetDefaultDrawQuality(UInt_t dq);
954 
955  static UInt_t LockColor();
956  static UInt_t UnlockColor();
957  static Bool_t IsColorLocked();
958 
959  static void Color(const TGLColor& color);
960  static void ColorAlpha(const TGLColor& color, UChar_t alpha);
961  static void ColorAlpha(const TGLColor& color, Float_t alpha);
962  static void ColorAlpha(Color_t color_index, Float_t alpha=1);
963  static void ColorTransparency(Color_t color_index, Char_t transparency=0);
964  static void Color3ub(UChar_t r, UChar_t g, UChar_t b);
965  static void Color4ub(UChar_t r, UChar_t g, UChar_t b, UChar_t a);
966  static void Color3ubv(const UChar_t* rgb);
967  static void Color4ubv(const UChar_t* rgba);
968  static void Color3f(Float_t r, Float_t g, Float_t b);
969  static void Color4f(Float_t r, Float_t g, Float_t b, Float_t a);
970  static void Color3fv(const Float_t* rgb);
971  static void Color4fv(const Float_t* rgba);
972 
973  // Coordinate conversion and extra scaling (needed for osx retina)
974  static void PointToViewport(Int_t& x, Int_t& y);
975  static void PointToViewport(Int_t& x, Int_t& y, Int_t& w, Int_t& h);
978  static Int_t GetPickingRadius();
979 
980  static Float_t GetPointSizeScale();
981  static void SetPointSizeScale(Float_t scale);
982  static Float_t GetLineWidthScale();
983  static void SetLineWidthScale(Float_t scale);
984 
985  static void PointSize(Float_t point_size);
986  static void LineWidth(Float_t line_width);
987 
988  static Float_t PointSize();
989  static Float_t LineWidth();
990 
991  static void BeginExtendPickRegion(Float_t scale);
992  static void EndExtendPickRegion();
993 
994  static void RenderPolyMarkers(const TAttMarker& marker, Char_t transp,
995  Float_t* p, Int_t n,
996  Int_t pick_radius=0, Bool_t selection=kFALSE,
997  Bool_t sec_selection=kFALSE);
998 
999  static void RenderPolyMarkers(const TAttMarker &marker, const std::vector<Double_t> &points,
1000  Double_t dX, Double_t dY, Double_t dZ);
1001 
1002  static void RenderPoints(const TAttMarker& marker,
1003  Float_t* p, Int_t n,
1004  Int_t pick_radius=0, Bool_t selection=kFALSE,
1005  Bool_t sec_selection=kFALSE);
1006 
1007  static void RenderPoints(const TAttMarker& marker,
1008  const std::vector<Double_t> &points);
1009 
1010  static void RenderCrosses(const TAttMarker& marker,
1011  Float_t* p, Int_t n,
1012  Bool_t sec_selection=kFALSE);
1013 
1014  static void RenderCrosses(const TAttMarker& marker,
1015  const std::vector<Double_t> &points,
1016  Double_t dX, Double_t dY, Double_t dZ);
1017 
1018  static void RenderPolyLine(const TAttLine& aline, Char_t transp,
1019  Float_t* p, Int_t n,
1020  Int_t pick_radius=0, Bool_t selection=kFALSE);
1021 
1022  static void BeginAttLine(const TAttLine& aline, Char_t transp,
1023  Int_t pick_radius=0, Bool_t selection=kFALSE);
1024  static void EndAttLine(Int_t pick_radius=0, Bool_t selection=kFALSE);
1025 
1026  // TODO: These draw routines should take LOD hints
1027  static void SetDrawColors(const UChar_t rgba[4]);
1028  static void DrawSphere(const TGLVertex3 & position, Double_t radius, const UChar_t rgba[4]);
1029  static void DrawLine(const TGLLine3 & line, ELineHeadShape head, Double_t size, const UChar_t rgba[4]);
1030  static void DrawLine(const TGLVertex3 & start, const TGLVector3 & vector, ELineHeadShape head,
1031  Double_t size, const UChar_t rgba[4]);
1032  static void DrawRing(const TGLVertex3 & center, const TGLVector3 & normal,
1033  Double_t radius, const UChar_t* rgba);
1034 
1035  static void DrawReferenceMarker(const TGLCamera & camera,
1036  const TGLVertex3 & pos,
1037  Float_t radius = 3,
1038  const UChar_t * rgba = 0);
1039  static void DrawSimpleAxes(const TGLCamera & camera,
1040  const TGLBoundingBox & bbox,
1041  Int_t axesType);
1042  static void DrawNumber(const TString & num,
1043  const TGLVertex3 & pos,
1044  Bool_t center = kFALSE);
1045 
1046  // Frequently used colors.
1047  static const UChar_t fgRed[4];
1048  static const UChar_t fgGreen[4];
1049  static const UChar_t fgBlue[4];
1050  static const UChar_t fgYellow[4];
1051  static const UChar_t fgWhite[4];
1052  static const UChar_t fgGrey[4];
1053 
1054  ClassDef(TGLUtil,0); // Wrapper class for misc GL pieces
1055 };
1056 
1057 /**************************************************************************/
1058 
1060 {
1061 private:
1064 
1068 
1069  void SetState(Bool_t s);
1070 
1071 public:
1072  TGLCapabilitySwitch(Int_t what, Bool_t state);
1074 };
1075 
1077 {
1078 private:
1081 
1084 
1085 public:
1086  TGLCapabilityEnabler(Int_t what, Bool_t state);
1088 };
1089 
1091 {
1092  TGLFloatHolder(const TGLFloatHolder&); // Not implemented
1093  TGLFloatHolder& operator=(const TGLFloatHolder&); // Not implemented
1094 
1099 
1100 public:
1101  TGLFloatHolder(Int_t what, Float_t state, void (*foo)(Float_t));
1102  ~TGLFloatHolder();
1103 };
1104 
1106 private:
1108 
1109 public:
1110  TGLEnableGuard(Int_t cap);
1111  ~TGLEnableGuard();
1112 
1113 private:
1114  TGLEnableGuard(const TGLEnableGuard &);
1116 };
1117 
1119 private:
1121 
1122 public:
1123  TGLDisableGuard(Int_t cap);
1124  ~TGLDisableGuard();
1125 
1126 private:
1129 };
1130 
1132  std::vector<UChar_t> fBuffer;
1135 
1136 public:
1138  virtual ~TGLSelectionBuffer();
1139 
1140  void ReadColorBuffer(Int_t width, Int_t height);
1141  void ReadColorBuffer(Int_t x, Int_t y, Int_t width, Int_t height);
1142  const UChar_t *GetPixelColor(Int_t px, Int_t py)const;
1143 
1144 private:
1147 
1148  ClassDef(TGLSelectionBuffer, 0); //Holds color buffer content for selection
1149 };
1150 
1151 template<class T>
1152 class TGL2DArray : public std::vector<T> {
1153 private:
1156  typedef typename std::vector<T>::size_type size_type;
1157 
1158 public:
1160  void SetMaxRow(Int_t max)
1161  {
1162  fMaxRow = max;
1163  }
1164  void SetRowLen(Int_t len)
1165  {
1166  fRowLen = len;
1167  }
1168  const T *operator [] (size_type ind)const
1169  {
1170  return &std::vector<T>::operator [](ind * fRowLen);
1171  }
1173  {
1174  return &std::vector<T>::operator [] (ind * fRowLen);
1175  }
1176 };
1177 
1178 class TGLPlotCoordinates;
1179 class TGLQuadric;
1180 class TAxis;
1181 
1182 namespace Rgl {
1183 
1184 extern const Float_t gRedEmission[];
1185 extern const Float_t gGreenEmission[];
1186 extern const Float_t gBlueEmission[];
1187 extern const Float_t gOrangeEmission[];
1188 extern const Float_t gWhiteEmission[];
1189 extern const Float_t gGrayEmission[];
1190 extern const Float_t gNullEmission[];
1191 
1192 typedef std::pair<Int_t, Int_t> BinRange_t;
1193 typedef std::pair<Double_t, Double_t> Range_t;
1194 
1195 void ObjectIDToColor(Int_t objectID, Bool_t highColor);
1196 Int_t ColorToObjectID(const UChar_t *color, Bool_t highColor);
1197 void DrawQuadOutline(const TGLVertex3 &v1, const TGLVertex3 &v2,
1198  const TGLVertex3 &v3, const TGLVertex3 &v4);
1199 void DrawQuadFilled(const TGLVertex3 &v0, const TGLVertex3 &v1,
1200  const TGLVertex3 &v2, const TGLVertex3 &v3,
1201  const TGLVector3 &normal);
1202 void DrawQuadFilled(const Double_t *v0, const Double_t *v1,
1203  const Double_t *v2, const Double_t *v3,
1204  const Double_t *normal);
1205 
1206 void DrawSmoothFace(const TGLVertex3 &v1, const TGLVertex3 &v2,
1207  const TGLVertex3 &v3, const TGLVector3 &norm1,
1208  const TGLVector3 &norm2, const TGLVector3 &norm3);
1209 void DrawBoxFront(Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax,
1210  Double_t zMin, Double_t zMax, Int_t fp);
1211 
1212 void DrawTransparentBox(Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax,
1213  Double_t zMin, Double_t zMax, Int_t fp);
1214 
1215 
1216 void DrawBoxFrontTextured(Double_t xMin, Double_t xMax, Double_t yMin,
1217  Double_t yMax, Double_t zMin, Double_t zMax,
1218  Double_t tMin, Double_t tMax, Int_t front);
1219 
1221  const Double_t *rgba1, const Double_t *rgba2);
1222 
1223 void DrawQuadStripWithRadialGradientFill(unsigned nPoints, const Double_t *inner, const Double_t *innerRGBA,
1224  const Double_t *outer, const Double_t *outerRGBA);
1225 
1226 #ifndef __CINT__
1227 void DrawTrapezoidTextured(const Double_t ver[][2], Double_t zMin, Double_t zMax,
1228  Double_t tMin, Double_t tMax);
1229 void DrawTrapezoidTextured(const Double_t ver[][3], Double_t texMin, Double_t texMax);
1230 void DrawTrapezoidTextured2(const Double_t ver[][2], Double_t zMin, Double_t zMax,
1231  Double_t tMin, Double_t tMax);
1232 #endif
1233 
1234 void DrawCylinder(TGLQuadric *quadric, Double_t xMin, Double_t xMax, Double_t yMin,
1235  Double_t yMax, Double_t zMin, Double_t zMax);
1236 void DrawSphere(TGLQuadric *quadric, Double_t xMin, Double_t xMax, Double_t yMin,
1237  Double_t yMax, Double_t zMin, Double_t zMax);
1238 void DrawError(Double_t xMin, Double_t xMax, Double_t yMin,
1239  Double_t yMax, Double_t zMin, Double_t zMax);
1240 
1241 #ifndef __CINT__
1242 void DrawTrapezoid(const Double_t ver[][2], Double_t zMin, Double_t zMax, Bool_t color = kTRUE);
1243 void DrawTrapezoid(const Double_t ver[][3]);
1244 #endif
1245 
1246 void DrawAxes(Int_t frontPoint, const Int_t *viewport, const TGLVertex3 *box2D,
1247  const TGLPlotCoordinates *plotCoord, TAxis *xAxis, TAxis *yAxis,
1248  TAxis *zAxis);
1249 void SetZLevels(TAxis *zAxis, Double_t zMin, Double_t zMax,
1250  Double_t zScale, std::vector<Double_t> &zLevels);
1251 
1252 void DrawFaceTextured(const TGLVertex3 &v1, const TGLVertex3 &v2, const TGLVertex3 &v3,
1253  Double_t t1, Double_t t2, Double_t t3, const TGLVector3 &norm1,
1254  const TGLVector3 &norm2, const TGLVector3 &norm3);
1255 void DrawFaceTextured(const TGLVertex3 &v1, const TGLVertex3 &v2, const TGLVertex3 &v3,
1256  Double_t t1, Double_t t2, Double_t t3, Double_t z, const TGLVector3 &planeNormal);
1257 void GetColor(Float_t v, Float_t vmin, Float_t vmax, Int_t type, Float_t *rgba);
1258 
1259 class TGuardBase {
1260 private:
1261  mutable Bool_t fActive;
1262 
1263  TGuardBase &operator = (const TGuardBase &rhs);
1264 protected:
1266  : fActive(kTRUE)
1267  {
1268  }
1270  : fActive(kTRUE)
1271  {
1272  rhs.fActive = kFALSE;
1273  }
1274 
1276  {
1277  return fActive;
1278  }
1279 
1280 public:
1281  void Stop()const
1282  {
1283  fActive = kFALSE;
1284  }
1285 };
1286 
1287 template<class Func, class Arg>
1288 class TOneArgGuard : public TGuardBase {
1289 private:
1291  Arg fArg;
1292 public:
1294  : fFunc(f), fArg(a)
1295  {
1296  }
1298  {
1299  if (IsActive())
1300  fFunc(fArg);
1301  }
1302 };
1303 
1304 template<class Func, class Arg1, class Arg2>
1305 class TTwoArgsGuard : public TGuardBase {
1306 private:
1308  Arg1 fArg1;
1309  Arg2 fArg2;
1310 
1311 public:
1312  TTwoArgsGuard(Func f, Arg1 a1, Arg2 a2)
1313  : fFunc(f), fArg1(a1), fArg2(a2)
1314  {
1315  }
1317  {
1318  if (IsActive())
1319  fFunc(fArg1, fArg2);
1320  }
1321 };
1322 
1323 template<class Func, class Arg>
1325 {
1326  return TOneArgGuard<Func, Arg>(f, a);
1327 }
1328 
1329 template<class Func, class Arg1, class Arg2>
1331 {
1332  return TTwoArgsGuard<Func, Arg1, Arg2>(f, a1, a2);
1333 }
1334 
1335 }//namespace Rgl.
1336 
1338 private:
1339  std::vector<UChar_t> fTexels;
1340  const std::vector<Double_t> *fContours;
1342  mutable UInt_t fTexture;
1345 
1346  TGLLevelPalette(const TGLLevelPalette&); // Not implemented
1347  TGLLevelPalette& operator=(const TGLLevelPalette&); // Not implemented
1348 
1349 public:
1350  TGLLevelPalette();
1351 
1352  Bool_t GeneratePalette(UInt_t paletteSize, const Rgl::Range_t &zRange, Bool_t checkSize = kTRUE);
1353 
1354  void SetContours(const std::vector<Double_t> *contours);
1355 
1356  void EnableTexture(Int_t mode)const;
1357  void DisableTexture()const;
1358 
1359  Int_t GetPaletteSize()const;
1360 
1362 
1363  const UChar_t *GetColour(Double_t z)const;
1364  const UChar_t *GetColour(Int_t ind)const;
1365 };
1366 
1367 #endif // ROOT_TGLUtil
Int_t fY
Definition: TGLUtil.h:426
virtual ~TGLColor()
Destructor.
Definition: TGLUtil.cxx:1220
static UInt_t fgDefaultDrawQuality
Definition: TGLUtil.h:915
static void DrawRing(const TGLVertex3 &center, const TGLVector3 &normal, Double_t radius, const UChar_t *rgba)
Draw ring, centered on &#39;center&#39;, lying on plane defined by &#39;center&#39; &amp; &#39;normal&#39; of outer radius &#39;radiu...
Definition: TGLUtil.cxx:2399
std::vector< T >::size_type size_type
Definition: TGLUtil.h:1156
void SetZLevels(TAxis *zAxis, Double_t zMin, Double_t zMax, Double_t zScale, std::vector< Double_t > &zLevels)
Definition: TGLUtil.cxx:3787
void SetRowLen(Int_t len)
Definition: TGLUtil.h:1164
std::vector< UChar_t > fTexels
Definition: TGLUtil.h:1339
const UChar_t * CArr() const
Definition: TGLUtil.h:799
Int_t fMaxRow
Definition: TGLUtil.h:1155
Double_t & Y()
Definition: TGLUtil.h:121
Class encapsulating a set of colors used throughout standard rendering.
Definition: TGLUtil.h:834
static GLUtesselator * GetDrawTesselator3fv()
Returns a tesselator for direct drawing when using 3-vertices with single precision.
Definition: TGLUtil.cxx:1499
void(* fFoo)(Float_t)
Definition: TGLUtil.h:1098
static UInt_t fgColorLockCount
Definition: TGLUtil.h:918
void DrawFaceTextured(const TGLVertex3 &v1, const TGLVertex3 &v2, const TGLVertex3 &v3, Double_t t1, Double_t t2, Double_t t3, const TGLVector3 &norm1, const TGLVector3 &norm2, const TGLVector3 &norm3)
Draw textured triangle.
Definition: TGLUtil.cxx:3803
void ReadColorBuffer(Int_t width, Int_t height)
Read color buffer.
Definition: TGLUtil.cxx:2769
void DrawQuadFilled(const TGLVertex3 &v0, const TGLVertex3 &v1, const TGLVertex3 &v2, const TGLVertex3 &v3, const TGLVector3 &normal)
Draw quad face.
Definition: TGLUtil.cxx:2920
Abstract base camera class - concrete classes for orthographic and perspective cameras derive from it...
Definition: TGLCamera.h:43
static void Color(const TGLColor &color)
Set color from TGLColor.
Definition: TGLUtil.cxx:1658
Int_t Width() const
Definition: TGLUtil.h:451
TGLUtil(const TGLUtil &)
UChar_t * Arr()
Definition: TGLUtil.h:798
void MultiplyIP(TGLVector3 &v, Double_t w=1) const
Multiply vector in-place.
Definition: TGLUtil.cxx:1103
static double p3(double t, double a, double b, double c, double d)
Wrapper class for various misc static functions - error checking, draw helpers etc.
Definition: TGLUtil.h:876
void SetTranslation(Double_t x, Double_t y, Double_t z)
Set matrix translation components x,y,z.
Definition: TGLUtil.cxx:804
void SetGreen(Int_t v)
Definition: TGLUtil.h:810
void StdLightBackground()
Set defaults for light (white) background.
Definition: TGLUtil.cxx:1406
static void ColorTransparency(Color_t color_index, Char_t transparency=0)
Set color from color_index and ROOT-style transparency (default 0).
Definition: TGLUtil.cxx:1702
const Double_t * CArr() const
Definition: TGLUtil.h:562
Double_t & Z()
Definition: TGLUtil.h:123
static const UChar_t fgYellow[4]
Definition: TGLUtil.h:1050
Double_t C() const
Definition: TGLUtil.h:554
Bool_t IsScalingForRender() const
Return true if matrix is to be considered a scaling matrix for rendering.
Definition: TGLUtil.cxx:1139
void TransformVertex(TGLVertex3 &vertex) const
Transform passed &#39;vertex&#39; by this matrix - converts local frame to parent.
Definition: TGLUtil.cxx:961
Double_t Invert()
Invert the matrix, returns determinant.
Definition: TGLUtil.cxx:999
virtual ~TGLLine3()
Destroy 3D line object.
Definition: TGLUtil.cxx:215
TLine * line
const Float_t gNullEmission[]
Definition: TGLUtil.cxx:2814
const TGLColor & Selection(Int_t i) const
Definition: TGLUtil.h:859
float Float_t
Definition: RtypesCore.h:53
Double_t D() const
Definition: TGLUtil.h:555
const TGLVertex3 & operator+=(const TGLVector3 &val)
Definition: TGLUtil.h:277
static void DrawReferenceMarker(const TGLCamera &camera, const TGLVertex3 &pos, Float_t radius=3, const UChar_t *rgba=0)
Draw a sphere- marker on world-coordinate &#39;pos&#39; with pixel radius &#39;radius&#39;.
Definition: TGLUtil.cxx:2440
void SetBaseVec(Int_t b, Double_t x, Double_t y, Double_t z)
Definition: TGLUtil.h:732
TGLVertex3 operator-() const
Definition: TGLUtil.h:166
TGLVector3 GetTranslation() const
Return the translation component of matrix.
Definition: TGLUtil.cxx:822
std::pair< Double_t, Double_t > Range_t
Definition: TGLUtil.h:1193
double T(double x)
Definition: ChebyshevPol.h:34
16 component (4x4) transform matrix - column MAJOR as per GL.
Definition: TGLUtil.h:596
Int_t & Y()
Definition: TGLUtil.h:450
void DrawQuadStripWithRadialGradientFill(unsigned nPoints, const Double_t *inner, const Double_t *innerRGBA, const Double_t *outer, const Double_t *outerRGBA)
TODO: is it possible to use GLdouble to avoid problems with Double_t/GLdouble if they are not the sam...
Definition: TGLUtil.cxx:3184
Class encapsulating color information in preferred GL format - an array of four unsigned bytes...
Definition: TGLUtil.h:783
void RotateIP(TGLVector3 &v) const
Rotate vector in-place. Translation is not applied.
Definition: TGLUtil.cxx:1115
static void DrawLine(const TGLLine3 &line, ELineHeadShape head, Double_t size, const UChar_t rgba[4])
Draw thick line (tube) defined by &#39;line&#39;, with head at end shape &#39;head&#39; - box/arrow/none, (head) size &#39;size&#39;, color &#39;rgba&#39;.
Definition: TGLUtil.cxx:2333
TH1 * h
Definition: legend2.C:5
Bool_t fActive
Definition: TGLUtil.h:1261
const Double_t * CArr() const
Definition: TGLUtil.h:125
TGLCapabilitySwitch & operator=(const TGLCapabilitySwitch &)
virtual ~TGLUtil()
Definition: TGLUtil.h:933
void Expand(Int_t x, Int_t y)
Expand the rect to encompass point (x,y)
Definition: TGLUtil.cxx:291
static void DrawSimpleAxes(const TGLCamera &camera, const TGLBoundingBox &bbox, Int_t axesType)
Draw simple xyz-axes for given bounding-box.
Definition: TGLUtil.cxx:2455
TGLMatrix & operator*=(const TGLMatrix &rhs)
Definition: TGLUtil.h:622
static void BeginAttLine(const TAttLine &aline, Char_t transp, Int_t pick_radius=0, Bool_t selection=kFALSE)
Setup drawing parameters according to passed TAttLine.
Definition: TGLUtil.cxx:2233
std::vector< TGLPlane >::const_iterator TGLPlaneSet_ci
Definition: TGLUtil.h:572
TGLEnableGuard & operator=(const TGLEnableGuard &)
void Fill(Double_t val)
Definition: TGLUtil.h:203
static void Color3fv(const Float_t *rgb)
Wrapper for glColor3fv.
Definition: TGLUtil.cxx:1764
void Dump() const
Output vertex component values to std::cout.
Definition: TGLUtil.cxx:131
static UInt_t GetDrawQuality()
static: get draw quality
Definition: TGLUtil.cxx:1566
static void RenderPoints(const TAttMarker &marker, Float_t *p, Int_t n, Int_t pick_radius=0, Bool_t selection=kFALSE, Bool_t sec_selection=kFALSE)
Render markers as circular or square points.
Definition: TGLUtil.cxx:1981
static Float_t GetScreenScalingFactor()
Returns scaling factor between screen points and GL viewport pixels.
Definition: TGLUtil.cxx:1813
TGLRect()
Positive width/height.
Definition: TGLUtil.cxx:259
void Transpose3x3()
Transpose the top left 3x3 matrix component along major diagonal Supported as currently incompatibili...
Definition: TGLUtil.cxx:975
TGL2DArray()
Definition: TGLUtil.h:1159
Double_t Mag() const
Definition: TGLUtil.h:299
void StdDarkBackground()
Set defaults for dark (black) background.
Definition: TGLUtil.cxx:1389
void Stop() const
Definition: TGLUtil.h:1281
void Set(const TGLVertex3 &start, const TGLVertex3 &end)
Set 3D line running from &#39;start&#39; to &#39;end&#39;.
Definition: TGLUtil.cxx:222
Double_t fVals[16]
Definition: TGLUtil.h:600
Basic string class.
Definition: TString.h:129
static const UChar_t fgGrey[4]
Definition: TGLUtil.h:1052
const Float_t gBlueEmission[]
Definition: TGLUtil.cxx:2810
TTime operator/(const TTime &t1, const TTime &t2)
Definition: TTime.h:87
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TArc * a
Definition: textangle.C:12
Double_t & operator[](Int_t index)
Definition: TGLUtil.h:682
virtual ~TGLPlane()
Destroy plane object.
Definition: TGLUtil.cxx:419
void SetRed(Int_t v)
Definition: TGLUtil.h:809
static void PointToViewport(Int_t &x, Int_t &y)
Convert from point/screen coordinates to GL viewport coordinates.
Definition: TGLUtil.cxx:1784
Int_t fMaxPaletteSize
Definition: TGLUtil.h:1343
void DrawBoxWithGradientFill(Double_t y1, Double_t y2, Double_t x1, Double_t x2, const Double_t *rgba1, const Double_t *rgba2)
Definition: TGLUtil.cxx:3164
static void RenderPolyMarkers(const TAttMarker &marker, Char_t transp, Float_t *p, Int_t n, Int_t pick_radius=0, Bool_t selection=kFALSE, Bool_t sec_selection=kFALSE)
Render polymarkers at points specified by p-array.
Definition: TGLUtil.cxx:1941
void SetTransparency(Char_t transparency)
Set alpha from the transparency.
Definition: TGLUtil.cxx:1335
TGLColor & Markup()
Definition: TGLUtil.h:852
TGLEnableGuard(Int_t cap)
TGLEnableGuard constructor.
Definition: TGLUtil.cxx:2714
Wrapper class for GLU quadric shape drawing object.
Definition: TGLQuadric.h:27
TGLColor fForeground
Definition: TGLUtil.h:838
Float_t fState
Definition: TGLUtil.h:1096
~TGLCapabilitySwitch()
Destructor - reset state if changed.
Definition: TGLUtil.cxx:2655
void Offset(Int_t dX, Int_t dY)
Definition: TGLUtil.h:488
void Set(Double_t x, Double_t y, Double_t z)
Definition: TGLUtil.h:209
TLatex * t1
Definition: textangle.C:20
TGLColor & operator=(const TGLColor &c)
Assignment operator.
Definition: TGLUtil.cxx:1227
void DrawAxes(Int_t frontPoint, const Int_t *viewport, const TGLVertex3 *box2D, const TGLPlotCoordinates *plotCoord, TAxis *xAxis, TAxis *yAxis, TAxis *zAxis)
Using front point, find, where to draw axes and which labels to use for them gVirtualX-&gt;SelectWindow(...
Definition: TGLUtil.cxx:3726
Double_t B() const
Definition: TGLUtil.h:553
Int_t CenterX() const
Definition: TGLUtil.h:455
Double_t fVals[4]
Definition: TGLUtil.h:529
TGLLevelPalette()
Ctor.
Definition: TGLUtil.cxx:4117
static const UChar_t fgRed[4]
Definition: TGLUtil.h:1047
TGLMatrix()
Construct default identity matrix:
Definition: TGLUtil.cxx:634
TGLVertex3()
Construct a default (0.0, 0.0, 0.0) vertex.
Definition: TGLUtil.cxx:54
Rgl::EOverlap Overlap(const TGLRect &other) const
Return overlap result (kInside, kOutside, kPartial) of this rect with &#39;other&#39;.
Definition: TGLUtil.cxx:327
void DrawQuadOutline(const TGLVertex3 &v1, const TGLVertex3 &v2, const TGLVertex3 &v3, const TGLVertex3 &v4)
Draw quad outline.
Definition: TGLUtil.cxx:2906
TGLVertex3 fVertex
Definition: TGLUtil.h:391
Char_t GetTransparency() const
Returns transparency value.
Definition: TGLUtil.cxx:1250
Marker Attributes class.
Definition: TAttMarker.h:19
void Dump() const
Output 16 matrix components to std::cout.
Definition: TGLUtil.cxx:1160
TGLVector3 operator-() const
Definition: TGLUtil.h:293
void EnableTexture(Int_t mode) const
Enable 1D texture.
Definition: TGLUtil.cxx:4193
double sqrt(double)
static const double x2[5]
Double_t x[n]
Definition: legend1.C:17
const Float_t gWhiteEmission[]
Definition: TGLUtil.cxx:2812
Int_t & Height()
Definition: TGLUtil.h:454
void Translate(const TGLVector3 &vect)
Shift matrix translation components by &#39;vect&#39; in parent frame.
Definition: TGLUtil.cxx:830
Double_t DistanceTo(const TGLVertex3 &vertex) const
Distance from plane to vertex.
Definition: TGLUtil.cxx:520
virtual ~TColorLocker()
Definition: TGLUtil.h:883
#define ClassDef(name, id)
Definition: Rtypes.h:297
const TGLVertex3 & operator-=(const TGLVector3 &val)
Definition: TGLUtil.h:269
void DisableTexture() const
Disable 1D texture.
Definition: TGLUtil.cxx:4212
void Move3LF(Double_t x, Double_t y, Double_t z)
Translate in local frame along all base vectors simultaneously.
Definition: TGLUtil.cxx:850
void Set(const TGLVertex3 &origin, const TGLVector3 &zAxis, const TGLVector3 &xAxis=0)
Set matrix which when applied puts local origin at &#39;origin&#39; and the local Z axis in direction &#39;z&#39;...
Definition: TGLUtil.cxx:764
Rgl::Range_t fZRange
Definition: TGLUtil.h:1344
static void Color3ub(UChar_t r, UChar_t g, UChar_t b)
Wrapper for glColor3ub.
Definition: TGLUtil.cxx:1716
void SetState(Bool_t s)
Definition: TGLUtil.cxx:2663
TGLVector3 fVector
Start vertex of line.
Definition: TGLUtil.h:392
3 component (x/y/z) vertex class.
Definition: TGLUtil.h:82
void Dump() const
Output plane equation to std::out.
Definition: TGLUtil.cxx:444
~TGLCapabilityEnabler()
Destructor - reset state if changed.
Definition: TGLUtil.cxx:2686
TGLVertex3 & operator=(const TGLVertex3 &rhs)
Definition: TGLUtil.h:154
static void DrawSphere(const TGLVertex3 &position, Double_t radius, const UChar_t rgba[4])
Draw sphere, centered on vertex &#39;position&#39;, with radius &#39;radius&#39;, color &#39;rgba&#39;.
Definition: TGLUtil.cxx:2318
static GLUtesselator * GetDrawTesselator4dv()
Returns a tesselator for direct drawing when using 4-vertices with double precision.
Definition: TGLUtil.cxx:1532
static Float_t GetPointSizeScale()
Get global point-size scale.
Definition: TGLUtil.cxx:1844
static void Color4ub(UChar_t r, UChar_t g, UChar_t b, UChar_t a)
Wrapper for glColor4ub.
Definition: TGLUtil.cxx:1724
void RotateLF(Int_t i1, Int_t i2, Double_t amount)
Rotate in local frame.
Definition: TGLUtil.cxx:925
void DrawTrapezoidTextured2(const Double_t ver[][2], Double_t zMin, Double_t zMax, Double_t tMin, Double_t tMax)
In polar coordinates, box became trapezoid.
Definition: TGLUtil.cxx:3462
TTime operator-(const TTime &t1, const TTime &t2)
Definition: TTime.h:83
const TGLColor & Markup() const
Definition: TGLUtil.h:858
void RotatePF(Int_t i1, Int_t i2, Double_t amount)
Rotate in parent frame. Does optimised version of MultLeft.
Definition: TGLUtil.cxx:942
static double p2(double t, double a, double b, double c)
TGLColor fSelection[5]
Definition: TGLUtil.h:841
static Int_t fgPickingRadius
Definition: TGLUtil.h:927
Int_t & Width()
Definition: TGLUtil.h:452
Viewport (pixel base) 2D rectangle class.
Definition: TGLUtil.h:422
std::vector< UChar_t > fBuffer
Definition: TGLUtil.h:1132
Double_t * Arr()
Definition: TGLUtil.h:664
3 component (x/y/z) vector class.
Definition: TGLUtil.h:246
std::vector< TGLPlane >::iterator TGLPlaneSet_i
Definition: TGLUtil.h:571
static UInt_t fgDrawQuality
Definition: TGLUtil.h:916
static Bool_t IsColorLocked()
Returns true if color lock-count is greater than 0.
Definition: TGLUtil.cxx:1650
TString operator+(const TString &s1, const TString &s2)
Use the special concatenation constructor.
Definition: TString.cxx:1448
static UInt_t LockColor()
Prevent further color changes.
Definition: TGLUtil.cxx:1630
static UInt_t UnlockColor()
Allow color changes.
Definition: TGLUtil.cxx:1638
TGLSelectionBuffer()
TGLSelectionBuffer constructor.
Definition: TGLUtil.cxx:2754
TGLVector3 Multiply(const TGLVector3 &v, Double_t w=1) const
Multiply vector.
Definition: TGLUtil.cxx:1077
void SetIdentity()
Set matrix to identity.
Definition: TGLUtil.cxx:793
Bool_t IsActive() const
Definition: TGLUtil.h:1275
void Error(const char *location, const char *msgfmt,...)
void MultLeft(const TGLMatrix &lhs)
Multiply with matrix lhs on left.
Definition: TGLUtil.cxx:746
TGLColor fMarkup
Definition: TGLUtil.h:840
static void SetDefaultDrawQuality(UInt_t dq)
static: set default draw quality
Definition: TGLUtil.cxx:1598
short Color_t
Definition: RtypesCore.h:79
Int_t ColorToObjectID(const UChar_t *color, Bool_t highColor)
Definition: TGLUtil.cxx:2884
REAL * vertex
Definition: triangle.c:512
static void SetPointSizeScale(Float_t scale)
Set global point-size scale.
Definition: TGLUtil.cxx:1852
void SetContours(const std::vector< Double_t > *contours)
Clear :)
Definition: TGLUtil.cxx:4185
point * points
Definition: X3DBuffer.c:20
void ObjectIDToColor(Int_t objectID, Bool_t highColor)
Object id encoded as rgb triplet.
Definition: TGLUtil.cxx:2858
static const UChar_t fgBlue[4]
Definition: TGLUtil.h:1049
TGLVector3 GetBaseVec(Int_t b) const
Definition: TGLUtil.h:753
Definition: TGLUtil.h:58
TGLColorSet & operator=(const TGLColorSet &s)
Assignment operator.
Definition: TGLUtil.cxx:1375
const UChar_t * GetColour(Double_t z) const
Get color.
Definition: TGLUtil.cxx:4258
static Float_t fgLineWidth
Definition: TGLUtil.h:921
void DrawBoxFront(Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax, Double_t zMin, Double_t zMax, Int_t fp)
Draws lego&#39;s bar as a 3d box.
Definition: TGLUtil.cxx:2974
static Float_t fgPointSizeScale
Definition: TGLUtil.h:922
void DrawError(Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax, Double_t zMin, Double_t zMax)
Definition: TGLUtil.cxx:3265
static void EndAttLine(Int_t pick_radius=0, Bool_t selection=kFALSE)
Restore previous line drawing state.
Definition: TGLUtil.cxx:2269
TGLFloatHolder(const TGLFloatHolder &)
static double C[]
TGuardBase & operator=(const TGuardBase &rhs)
static void SetLineWidthScale(Float_t scale)
Set global line-width scale.
Definition: TGLUtil.cxx:1868
void DrawSmoothFace(const TGLVertex3 &v1, const TGLVertex3 &v2, const TGLVertex3 &v3, const TGLVector3 &norm1, const TGLVector3 &norm2, const TGLVector3 &norm3)
Draws triangle face, each vertex has its own averaged normal.
Definition: TGLUtil.cxx:2950
TRandom2 r(17)
Double_t * Arr()
Definition: TGLUtil.h:126
Class to manage histogram axis.
Definition: TAxis.h:30
EGLCoordType
Definition: TGLUtil.h:41
static void InitializeIfNeeded()
Initialize globals that require other libraries to be initialized.
Definition: TGLUtil.cxx:1543
const Float_t gGreenEmission[]
Definition: TGLUtil.cxx:2809
const Float_t gRedEmission[]
Definition: TGLUtil.cxx:2808
SVector< double, 2 > v
Definition: Dict.h:5
static const UChar_t fgWhite[4]
Definition: TGLUtil.h:1051
static GLUtesselator * GetDrawTesselator4fv()
Returns a tesselator for direct drawing when using 4-vertices with single precision.
Definition: TGLUtil.cxx:1510
TOneArgGuard< Func, Arg > make_guard(Func f, Arg a)
Definition: TGLUtil.h:1324
Double_t GetTexCoord(Double_t z) const
Get tex coordinate.
Definition: TGLUtil.cxx:4229
std::pair< Int_t, Int_t > BinRange_t
Definition: TGLUtil.h:1192
TGLFloatHolder & operator=(const TGLFloatHolder &)
TGLColorSet()
Constructor. Sets default for dark background.
Definition: TGLUtil.cxx:1360
TDrawQualityScaler(Float_t fac)
Definition: TGLUtil.h:905
TGLCapabilityEnabler & operator=(const TGLCapabilityEnabler &)
const TGLVertex3 & Start() const
Definition: TGLUtil.h:405
static void Color4f(Float_t r, Float_t g, Float_t b, Float_t a)
Wrapper for glColor4f.
Definition: TGLUtil.cxx:1756
TTime operator*(const TTime &t1, const TTime &t2)
Definition: TTime.h:85
UChar_t GetRed() const
Definition: TGLUtil.h:801
const Float_t gGrayEmission[]
Definition: TGLUtil.cxx:2813
Helper class for plot-painters holding information about axis ranges, numbers of bins and flags if ce...
Double_t Aspect() const
Definition: TGLUtil.h:501
void Minimum(const TGLVertex3 &other)
Definition: TGLUtil.cxx:112
UChar_t GetBlue() const
Definition: TGLUtil.h:803
const TGLColor & Background() const
Definition: TGLUtil.h:855
unsigned int UInt_t
Definition: RtypesCore.h:42
static void DrawNumber(const TString &num, const TGLVertex3 &pos, Bool_t center=kFALSE)
Draw number in string &#39;num&#39; via internal 8x8-pixel bitmap on vertex &#39;pos&#39;.
Definition: TGLUtil.cxx:2595
Int_t & X()
Definition: TGLUtil.h:448
Int_t Longest() const
Definition: TGLUtil.h:495
short Short_t
Definition: RtypesCore.h:35
TGLUtil & operator=(const TGLUtil &)
UInt_t fTexture
Definition: TGLUtil.h:1342
static void Color4fv(const Float_t *rgba)
Wrapper for glColor4fv.
Definition: TGLUtil.cxx:1772
3D space, fixed length, line class, with direction / length &#39;vector&#39;, passing through point &#39;vertex&#39;...
Definition: TGLUtil.h:387
static Float_t PointSize()
Get the point-size, taking the global scaling into account.
Definition: TGLUtil.cxx:1896
static double p1(double t, double a, double b)
~TGLDisableGuard()
TGLDisableGuard destructor.
Definition: TGLUtil.cxx:2740
TGLPlane()
Construct a default plane of x + y + z = 0.
Definition: TGLUtil.cxx:366
void DrawTransparentBox(Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax, Double_t zMin, Double_t zMax, Int_t fp)
Draws lego&#39;s bar as a 3d box.
Definition: TGLUtil.cxx:3024
TString AsString() const
Return string describing the color.
Definition: TGLUtil.cxx:1343
Int_t Top() const
Definition: TGLUtil.h:459
Int_t X() const
Definition: TGLUtil.h:447
Bool_t operator==(const TGLVertex3 &rhs) const
Definition: TGLUtil.h:148
TGLColor()
Default constructor. Color is initialized to black.
Definition: TGLUtil.cxx:1186
Bool_t fFlip
Definition: TGLUtil.h:1097
TGLColor fOutline
Definition: TGLUtil.h:839
Int_t Right() const
Definition: TGLUtil.h:458
TGLVector3 & operator=(const TGLVertex3 &v)
Definition: TGLUtil.h:255
TGLVertex3 NearestOn(const TGLVertex3 &point) const
Return nearest point on plane.
Definition: TGLUtil.cxx:528
Int_t Bottom() const
Definition: TGLUtil.h:460
static const UChar_t fgGreen[4]
Definition: TGLUtil.h:1048
const Bool_t kFALSE
Definition: RtypesCore.h:92
TGLVector3 Norm() const
Definition: TGLUtil.h:557
Int_t * CArr()
Definition: TGLUtil.h:445
static void Color3f(Float_t r, Float_t g, Float_t b)
Wrapper for glColor3f.
Definition: TGLUtil.cxx:1748
const Int_t * CArr() const
Definition: TGLUtil.h:444
TGLColor fBackground
Definition: TGLUtil.h:837
Double_t Dot(const TGLVector3 &v1, const TGLVector3 &v2)
Definition: TGLUtil.h:318
static Float_t fgPointLineScalingFactor
Definition: TGLUtil.h:926
const TGLVertex3 End() const
Definition: TGLUtil.h:406
static const double x1[5]
double f(double x)
std::vector< TGLPlane > TGLPlaneSet_t
Definition: TGLUtil.h:570
Double_t & operator[](Int_t index)
Definition: TGLUtil.h:181
static Float_t fgScreenScalingFactor
Definition: TGLUtil.h:925
double Double_t
Definition: RtypesCore.h:55
void SetCorner(Int_t x, Int_t y)
Definition: TGLUtil.h:481
void Negate()
Negate the plane.
Definition: TGLUtil.cxx:509
TGLCapabilitySwitch(const TGLCapabilitySwitch &)
Bool_t ValidIndex(UInt_t index) const
Definition: TGLUtil.h:603
void DrawTrapezoidTextured(const Double_t ver[][2], Double_t zMin, Double_t zMax, Double_t tMin, Double_t tMax)
In polar coordinates, box became trapezoid.
Definition: TGLUtil.cxx:3385
void Rotate(const TGLVertex3 &pivot, const TGLVector3 &axis, Double_t angle)
Update matrix so resulting transform has been rotated about &#39;pivot&#39; (in parent frame), round vector &#39;axis&#39;, through &#39;angle&#39; (radians) Equivalent to glRotate function, but with addition of translation and compounded on top of existing.
Definition: TGLUtil.cxx:898
int type
Definition: TGX11.cxx:120
TGLDisableGuard & operator=(const TGLDisableGuard &)
Double_t y[n]
Definition: legend1.C:17
void MultRight(const TGLMatrix &rhs)
Multiply with matrix rhs on right.
Definition: TGLUtil.cxx:730
static void BeginExtendPickRegion(Float_t scale)
Definition: TGLUtil.cxx:1913
static void RenderPolyLine(const TAttLine &aline, Char_t transp, Float_t *p, Int_t n, Int_t pick_radius=0, Bool_t selection=kFALSE)
Render poly-line as specified by the p-array.
Definition: TGLUtil.cxx:2213
Short_t fIndex
Definition: TGLUtil.h:787
Double_t fVals[3]
Definition: TGLUtil.h:87
static void EndExtendPickRegion()
Definition: TGLUtil.cxx:1928
Double_t X() const
Definition: TGLUtil.h:118
TGLColor & Background()
Definition: TGLUtil.h:849
TGLSelectionBuffer & operator=(const TGLSelectionBuffer &)
void Negate()
Definition: TGLUtil.h:140
Int_t GetPaletteSize() const
Get. Palette. Size.
Definition: TGLUtil.cxx:4221
void DrawTrapezoid(const Double_t ver[][2], Double_t zMin, Double_t zMax, Bool_t color=kTRUE)
Definition: TGLUtil.cxx:3315
void DrawSphere(TGLQuadric *quadric, Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax, Double_t zMin, Double_t zMax)
Cylinder for lego3.
Definition: TGLUtil.cxx:3242
Int_t Left() const
Definition: TGLUtil.h:457
EGLPlotType
Definition: TGLUtil.h:49
static Float_t GetPointLineScalingFactor()
Return extra scaling factor for points and lines.
Definition: TGLUtil.cxx:1824
static Int_t CheckError(const char *loc)
Check current GL error state, outputting details via ROOT Error method if one.
Definition: TGLUtil.cxx:1607
const TGLVector3 & Vector() const
Definition: TGLUtil.h:407
Concrete class describing an orientated (free) or axis aligned box of 8 vertices. ...
you should not use this method at all Int_t Int_t z
Definition: TRolke.cxx:630
void GetColor(Float_t v, Float_t vmin, Float_t vmax, Int_t type, Float_t *rgba)
This function creates color for parametric surface&#39;s vertex, using its &#39;u&#39; value. ...
Definition: TGLUtil.cxx:3844
TTwoArgsGuard(Func f, Arg1 a1, Arg2 a2)
Definition: TGLUtil.h:1312
Double_t Y() const
Definition: TGLUtil.h:120
virtual ~TGLMatrix()
Destroy matrix object.
Definition: TGLUtil.cxx:723
TGLVector3 GetScale() const
Get local axis scaling factors.
Definition: TGLUtil.cxx:1127
char Char_t
Definition: RtypesCore.h:29
Int_t CenterY() const
Definition: TGLUtil.h:456
Int_t Diagonal() const
Return the diagonal of the rectangle.
Definition: TGLUtil.cxx:316
typedef void((*Func_t)())
TGLColor & Selection(Int_t i)
Definition: TGLUtil.h:853
static void ResetDrawQuality()
static: reset draw quality
Definition: TGLUtil.cxx:1582
Int_t fHeight
Definition: TGLUtil.h:427
const UChar_t * GetPixelColor(Int_t px, Int_t py) const
Get pixel color.
Definition: TGLUtil.cxx:2793
Double_t * Arr()
Definition: TGLUtil.h:563
static Float_t GetLineWidthScale()
Returns global line-width scale.
Definition: TGLUtil.cxx:1860
TGLLine3(const TGLVertex3 &start, const TGLVertex3 &end)
Vector of line from fVertex.
Definition: TGLUtil.cxx:199
void Normalise()
Definition: TGLUtil.h:305
Color_t GetColorIndex() const
Returns color-index representing the color.
Definition: TGLUtil.cxx:1240
TGLVector3 & operator/=(Double_t val)
Definition: TGLUtil.h:284
~TGLEnableGuard()
TGLEnableGuard destructor.
Definition: TGLUtil.cxx:2723
TGLVertex3 & operator*=(Double_t f)
Definition: TGLUtil.h:172
TGLMatrix & operator=(const TGLMatrix &rhs)
Definition: TGLUtil.h:672
TGLDisableGuard(Int_t cap)
TGLDisableGuard constructor.
Definition: TGLUtil.cxx:2731
EOverlap
Definition: TGLUtil.h:33
static void RenderCrosses(const TAttMarker &marker, Float_t *p, Int_t n, Bool_t sec_selection=kFALSE)
Render markers as crosses.
Definition: TGLUtil.cxx:2101
TGLCapabilityEnabler(const TGLCapabilityEnabler &)
void SetBlue(Int_t v)
Definition: TGLUtil.h:811
static Float_t fgLineWidthScale
Definition: TGLUtil.h:923
static GLUtesselator * GetDrawTesselator3dv()
Returns a tesselator for direct drawing when using 3-vertices with double precision.
Definition: TGLUtil.cxx:1521
void Maximum(const TGLVertex3 &other)
Definition: TGLUtil.cxx:121
TGLColor & Outline()
Definition: TGLUtil.h:851
Int_t fRowLen
Definition: TGLUtil.h:1154
virtual ~TGLSelectionBuffer()
TGLSelectionBuffer destructor.
Definition: TGLUtil.cxx:2762
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
Definition: TRolke.cxx:630
void Scale(const TGLVector3 &scale)
Set matrix axis scales to &#39;scale&#39;.
Definition: TGLUtil.cxx:862
Int_t Height() const
Definition: TGLUtil.h:453
TGLLevelPalette & operator=(const TGLLevelPalette &)
static Int_t GetPickingRadius()
Returns picking radius.
Definition: TGLUtil.cxx:1832
static void SetDrawQuality(UInt_t dq)
static: set draw quality
Definition: TGLUtil.cxx:1574
virtual ~TGLRect()
Destroy rect object.
Definition: TGLUtil.cxx:284
const TGLColor & Foreground() const
Definition: TGLUtil.h:856
virtual ~TGLVertex3()
Destroy vertex object.
Definition: TGLUtil.cxx:86
static Float_t LineWidth()
Get the line-width, taking the global scaling into account.
Definition: TGLUtil.cxx:1904
void SetMaxRow(Int_t max)
Definition: TGLUtil.h:1160
UChar_t GetGreen() const
Definition: TGLUtil.h:802
unsigned char UChar_t
Definition: RtypesCore.h:34
Double_t Z() const
Definition: TGLUtil.h:122
TGLVector3 Cross(const TGLVector3 &v1, const TGLVector3 &v2)
Definition: TGLUtil.h:324
void DrawCylinder(TGLQuadric *quadric, Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax, Double_t zMin, Double_t zMax)
Cylinder for lego3.
Definition: TGLUtil.cxx:3211
Double_t A() const
Definition: TGLUtil.h:552
static Float_t fgPointSize
Definition: TGLUtil.h:920
void Normalise()
Normalise the plane.
Definition: TGLUtil.cxx:426
void Shift(TGLVector3 &shift)
Offset a vertex by vector &#39;shift&#39;.
Definition: TGLUtil.cxx:93
void DrawBoxFrontTextured(Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax, Double_t zMin, Double_t zMax, Double_t tMin, Double_t tMax, Int_t front)
Draws lego&#39;s bar as a 3d box LULULULU.
Definition: TGLUtil.cxx:3101
void SetColor(Int_t r, Int_t g, Int_t b, Int_t a=255)
Set color with Int_t values.
Definition: TGLUtil.cxx:1258
Int_t fWidth
Corner.
Definition: TGLUtil.h:427
Bool_t GeneratePalette(UInt_t paletteSize, const Rgl::Range_t &zRange, Bool_t checkSize=kTRUE)
Try to find colors for palette.
Definition: TGLUtil.cxx:4128
const T * operator[](size_type ind) const
Definition: TGLUtil.h:1168
virtual ~TGLColorSet()
Destructor.
Definition: TGLUtil.cxx:1368
Double_t & X()
Definition: TGLUtil.h:119
static void ColorAlpha(const TGLColor &color, UChar_t alpha)
Set color from TGLColor and alpha value.
Definition: TGLUtil.cxx:1666
const Bool_t kTRUE
Definition: RtypesCore.h:91
double norm(double *x, double *p)
Definition: unuranDistr.cxx:40
Int_t fX
Definition: TGLUtil.h:426
3D plane class - of format Ax + By + Cz + D = 0
Definition: TGLUtil.h:525
const Float_t gOrangeEmission[]
Definition: TGLUtil.cxx:2811
TGLColor & Foreground()
Definition: TGLUtil.h:850
virtual ~TGLVector3()
Destroy vector object.
Definition: TGLUtil.cxx:184
void Draw() const
Draw line in current basic GL color.
Definition: TGLUtil.cxx:241
UChar_t fRGBA[4]
Definition: TGLUtil.h:786
static void SetDrawColors(const UChar_t rgba[4])
Set basic draw colors from 4 component &#39;rgba&#39; Used by other TGLUtil drawing routines.
Definition: TGLUtil.cxx:2297
const Int_t n
Definition: legend1.C:16
Line Attributes class.
Definition: TAttLine.h:18
Int_t Y() const
Definition: TGLUtil.h:449
virtual ~TDrawQualityScaler()
Definition: TGLUtil.h:908
const Double_t * CArr() const
Definition: TGLUtil.h:663
TGLVector3()
Construct a default (0.0, 0.0, 0.0) vector.
Definition: TGLUtil.cxx:152
static void Color4ubv(const UChar_t *rgba)
Wrapper for glColor4ubv.
Definition: TGLUtil.cxx:1740
ELineHeadShape
Definition: TGLUtil.h:946
UChar_t GetAlpha() const
Definition: TGLUtil.h:804
EAxesType
Definition: TGLUtil.h:947
void MoveLF(Int_t ai, Double_t amount)
Translate in local frame.
Definition: TGLUtil.cxx:841
Bool_t ValidIndex(UInt_t index) const
Definition: TGLUtil.h:86
TGuardBase(const TGuardBase &rhs)
Definition: TGLUtil.h:1269
void SetAlpha(Int_t v)
Definition: TGLUtil.h:812
void Set(Int_t x, Int_t y, Int_t width, Int_t height)
Definition: TGLUtil.h:472
static void Color3ubv(const UChar_t *rgb)
Wrapper for glColor3ubv.
Definition: TGLUtil.cxx:1732
TOneArgGuard(Func f, Arg a)
Definition: TGLUtil.h:1293
static UInt_t GetDefaultDrawQuality()
static: get default draw quality
Definition: TGLUtil.cxx:1590
UInt_t fPaletteSize
Definition: TGLUtil.h:1341
void Set(const TGLPlane &other)
Assign from other.
Definition: TGLUtil.cxx:453
const std::vector< Double_t > * fContours
Definition: TGLUtil.h:1340
const TGLColor & Outline() const
Definition: TGLUtil.h:857
std::pair< Bool_t, TGLLine3 > Intersection(const TGLPlane &p1, const TGLPlane &p2)
Find 3D line interestion of this plane with &#39;other&#39;.
Definition: TGLUtil.cxx:544