Logo ROOT   6.14/05
Reference Guide
TEveTriangleSet.h
Go to the documentation of this file.
1 // @(#)root/eve:$Id$
2 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TEveTriangleSet
13 #define ROOT_TEveTriangleSet
14 
15 #include "TEveElement.h"
16 #include "TNamed.h"
17 #include "TAttBBox.h"
18 #include "TAtt3D.h"
19 
20 #include "TEveTrans.h"
21 
22 class TGeoMatrix;
23 
25  public TAtt3D,
26  public TAttBBox
27 {
28  friend class TEveTriangleSetEditor;
29  friend class TEveTriangleSetGL;
30 
31  TEveTriangleSet(const TEveTriangleSet&); // Not implemented
32  TEveTriangleSet& operator=(const TEveTriangleSet&); // Not implemented
33 
34 protected:
35  // Vertex data
37  Float_t* fVerts; //[3*fNVerts]
38 
39  // Triangle data
41  Int_t* fTrings; //[3*fNTrings]
42  Float_t* fTringNorms; //[3*fNTrings]
43  UChar_t* fTringCols; //[3*fNTrings]
44 
45 public:
46  TEveTriangleSet(Int_t nv, Int_t nt, Bool_t norms=kFALSE, Bool_t cols=kFALSE);
48 
49  virtual Bool_t CanEditMainTransparency() const { return kTRUE; }
50 
51  Int_t GetNVerts() const { return fNVerts; }
52  Int_t GetNTrings() const { return fNTrings; }
53 
54  Float_t* Vertex(Int_t i) { return &(fVerts[3*i]); }
55  Int_t* Triangle(Int_t i) { return &(fTrings[3*i]); }
56  Float_t* TriangleNormal(Int_t i) { return &(fTringNorms[3*i]); }
57  UChar_t* TriangleColor(Int_t i) { return &(fTringCols[3*i]); }
58 
60  { Float_t* v = Vertex(i); v[0] = x; v[1] = y; v[2] = z; }
61  void SetTriangle(Int_t i, Int_t v0, Int_t v1, Int_t v2)
62  { Int_t* t = Triangle(i); t[0] = v0; t[1] = v1; t[2] = v2; }
64  { UChar_t* c = TriangleColor(i); c[0] = r; c[1] = g; c[2] = b; c[3] = a; }
65 
67  void GenerateRandomColors();
68  void GenerateZNormalColors(Float_t fac=20, Int_t min=-20, Int_t max=20,
69  Bool_t interp=kFALSE, Bool_t wrap=kFALSE);
70 
71  virtual void ComputeBBox();
72  virtual void Paint(Option_t* option="");
73 
74  void SetTransparency(Char_t tr) { SetMainTransparency(tr); } // *MENU*
75 
76  static TEveTriangleSet* ReadTrivialFile(const char* file);
77 
78  ClassDef(TEveTriangleSet, 0); // Generic mesh or soup of triangles with per-triangle normals and colors.
79 };
80 
81 #endif
void SetTransparency(Char_t tr)
~TEveTriangleSet()
Destructor.
Editor for TEveTriangleSet class.
Float_t * fTringNorms
float Float_t
Definition: RtypesCore.h:53
const char Option_t
Definition: RtypesCore.h:62
Geometrical transformation package.
Definition: TGeoMatrix.h:40
Int_t * Triangle(Int_t i)
#define g(i)
Definition: RSha256.hxx:105
GL-renderer for TEveTriangleSet class.
Use this attribute class when an object should have 3D capabilities.
Definition: TAtt3D.h:19
void GenerateTriangleNormals()
Generate triangle normals via cross product of triangle edges.
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
void SetTriangle(Int_t i, Int_t v0, Int_t v1, Int_t v2)
A list of TEveElements.
Definition: TEveElement.h:459
virtual void Paint(Option_t *option="")
Paint this object. Only direct rendering is supported.
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:320
SEXP wrap(const TString &s)
Definition: RExports.h:67
ROOT::R::TRInterface & r
Definition: Object.C:4
SVector< double, 2 > v
Definition: Dict.h:5
auto * a
Definition: textangle.C:12
void SetTriangleColor(Int_t i, UChar_t r, UChar_t g, UChar_t b, UChar_t a=255)
TEveTriangleSet & operator=(const TEveTriangleSet &)
virtual void ComputeBBox()
Compute bounding box.
virtual void SetMainTransparency(Char_t t)
Set main-transparency.
const Bool_t kFALSE
Definition: RtypesCore.h:88
Float_t * TriangleNormal(Int_t i)
Int_t GetNVerts() const
Made from a list of vertices and a list of triangles (triplets of vertex indices).
Double_t y[n]
Definition: legend1.C:17
void SetVertex(Int_t i, Float_t x, Float_t y, Float_t z)
you should not use this method at all Int_t Int_t z
Definition: TRolke.cxx:630
char Char_t
Definition: RtypesCore.h:29
virtual Bool_t CanEditMainTransparency() const
UChar_t * TriangleColor(Int_t i)
Float_t * Vertex(Int_t i)
static TEveTriangleSet * ReadTrivialFile(const char *file)
Read a simple ascii input file describing vertices and triangles.
Definition: file.py:1
Helper for management of bounding-box information.
Definition: TAttBBox.h:17
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
#define c(i)
Definition: RSha256.hxx:101
Int_t GetNTrings() const
void GenerateRandomColors()
Assign random colors to all triangles.
unsigned char UChar_t
Definition: RtypesCore.h:34
TEveTriangleSet(const TEveTriangleSet &)
void GenerateZNormalColors(Float_t fac=20, Int_t min=-20, Int_t max=20, Bool_t interp=kFALSE, Bool_t wrap=kFALSE)
Generate triangle colors by the z-component of the normal.
const Bool_t kTRUE
Definition: RtypesCore.h:87
UChar_t * fTringCols