Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 "TAttBBox.h"
17#include "TAtt3D.h"
18
19#include "TEveTrans.h"
20
21class TGeoMatrix;
22
24 public TAtt3D,
25 public TAttBBox
26{
28 friend class TEveTriangleSetGL;
29
30 TEveTriangleSet(const TEveTriangleSet&); // Not implemented
31 TEveTriangleSet& operator=(const TEveTriangleSet&); // Not implemented
32
33protected:
34 // Vertex data
36 Float_t* fVerts; //[3*fNVerts]
37
38 // Triangle data
40 Int_t* fTrings; //[3*fNTrings]
41 Float_t* fTringNorms; //[3*fNTrings]
42 UChar_t* fTringCols; //[3*fNTrings]
43
44public:
46 ~TEveTriangleSet() override;
47
48 Bool_t CanEditMainTransparency() const override { return kTRUE; }
49
50 Int_t GetNVerts() const { return fNVerts; }
51 Int_t GetNTrings() const { return fNTrings; }
52
53 Float_t* Vertex(Int_t i) { return &(fVerts[3*i]); }
54 Int_t* Triangle(Int_t i) { return &(fTrings[3*i]); }
55 Float_t* TriangleNormal(Int_t i) { return &(fTringNorms[3*i]); }
56 UChar_t* TriangleColor(Int_t i) { return &(fTringCols[3*i]); }
57
59 { Float_t* v = Vertex(i); v[0] = x; v[1] = y; v[2] = z; }
61 { Int_t* t = Triangle(i); t[0] = v0; t[1] = v1; t[2] = v2; }
63 { UChar_t* c = TriangleColor(i); c[0] = r; c[1] = g; c[2] = b; c[3] = a; }
64
67 void GenerateZNormalColors(Float_t fac=20, Int_t min=-20, Int_t max=20,
68 Bool_t interp=kFALSE, Bool_t wrap=kFALSE);
69
70 void ComputeBBox() override;
71 void Paint(Option_t* option="") override;
72
73 void SetTransparency(Char_t tr) { SetMainTransparency(tr); } // *MENU*
74
75 static TEveTriangleSet* ReadTrivialFile(const char* file);
76
77 ClassDefOverride(TEveTriangleSet, 0); // Generic mesh or soup of triangles with per-triangle normals and colors.
78};
79
80#endif
#define b(i)
Definition RSha256.hxx:100
#define c(i)
Definition RSha256.hxx:101
#define g(i)
Definition RSha256.hxx:105
#define a(i)
Definition RSha256.hxx:99
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
unsigned char UChar_t
Definition RtypesCore.h:38
char Char_t
Definition RtypesCore.h:37
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Option_t Option_t option
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
Use this attribute class when an object should have 3D capabilities.
Definition TAtt3D.h:19
Helper for management of bounding-box information.
Definition TAttBBox.h:18
A list of TEveElements.
virtual void SetMainTransparency(Char_t t)
Set main-transparency.
Editor for TEveTriangleSet class.
GL-renderer for TEveTriangleSet class.
Made from a list of vertices and a list of triangles (triplets of vertex indices).
Float_t * fTringNorms
void ComputeBBox() override
Compute bounding box.
void SetTransparency(Char_t tr)
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.
void GenerateRandomColors()
Assign random colors to all triangles.
Float_t * Vertex(Int_t i)
Float_t * TriangleNormal(Int_t i)
void SetTriangle(Int_t i, Int_t v0, Int_t v1, Int_t v2)
Int_t GetNTrings() const
UChar_t * TriangleColor(Int_t i)
Bool_t CanEditMainTransparency() const override
~TEveTriangleSet() override
Destructor.
static TEveTriangleSet * ReadTrivialFile(const char *file)
Read a simple ascii input file describing vertices and triangles.
TEveTriangleSet(const TEveTriangleSet &)
void SetTriangleColor(Int_t i, UChar_t r, UChar_t g, UChar_t b, UChar_t a=255)
void SetVertex(Int_t i, Float_t x, Float_t y, Float_t z)
Int_t GetNVerts() const
TEveTriangleSet & operator=(const TEveTriangleSet &)
void GenerateTriangleNormals()
Generate triangle normals via cross product of triangle edges.
void Paint(Option_t *option="") override
Paint this object. Only direct rendering is supported.
Int_t * Triangle(Int_t i)
Geometrical transformation package.
Definition TGeoMatrix.h:38
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17