Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
REveBoxSet.hxx
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_REveBoxSet
13#define ROOT_REveBoxSet
14
15#include "ROOT/REveDigitSet.hxx"
17#include "ROOT/REveVector.hxx"
18
19class TGeoMatrix;
20class TRandom;
21
22namespace ROOT {
23namespace Experimental {
25{
26 friend class REveBoxSetGL;
27
28 REveBoxSet(const REveBoxSet&) = delete;
29 REveBoxSet& operator=(const REveBoxSet&) = delete;
30
31public:
33 kBT_Undef, // unknown-ignored
34 kBT_Vertices, // arbitrary box: specify its 8 vertices, 8*(x,y,z)
35 kBT_FreeBox = kBT_Vertices, // the old name of kBT_Vertices
36 kBT_Instanced, // axis-aligned box of the default size, see SetDefWidth(): specify its centre
37 kBT_InstancedScaled, // axis-aligned box: specify its centre and half size
38 kBT_InstancedScaledRotated // any transformation of the instance shape: specify its matrix
39 };
40
41 /// The shape every instance of a kBT_Instanced* box set draws.
48
49 struct Vertices_t : public DigitBase_t {
51 }; // the 8 vertices
52 struct Instanced_t : public DigitBase_t {
54 }; // centre
57 }; // centre and half size
60 }; // column-major matrix
61
62 using BFreeBox_t = Vertices_t; // the old name of Vertices_t
63
64protected:
65 EBoxType_e fBoxType; // Type of rendered box.
66 EInstanceShape_e fInstanceShape{kIS_Box}; // Shape of the instances of the kBT_Instanced* types.
67
68 Float_t fDefHalfWidth{0.5}; // Half size along x of a kBT_Instanced box.
69 Float_t fDefHalfHeight{0.5}; // Half size along y of a kBT_Instanced box.
70 Float_t fDefHalfDepth{0.5}; // Half size along z of a kBT_Instanced box.
71
72 Int_t fBoxSkip; // Number of boxes to skip for each drawn box during scene rotation.
73
74 Bool_t fDrawConeCap{false}; // Close the base of a cone.
75
76 static Int_t SizeofAtom(EBoxType_e bt);
77 void InstanceHalfSize(const DigitBase_t &digit, Float_t half[3]) const;
81
82public:
83 REveBoxSet(const char* n="REveBoxSet", const char* t="");
84 ~REveBoxSet() override {}
85
86 void Reset(EBoxType_e boxType, Bool_t valIsCol, Int_t chunkSize);
87 void Reset();
88
89 void AddVertices(const Float_t *verts);
90 void AddFreeBox(const Float_t *verts) { AddVertices(verts); } // the old name of AddVertices()
91 void AddBox(const Float_t *verts) { AddVertices(verts); } // the TEveBoxSet name of AddVertices()
92 void AddInstanceScaled(Float_t cx, Float_t cy, Float_t cz, Float_t hw, Float_t hh, Float_t hd);
94 void AddInstance(Float_t cx, Float_t cy, Float_t cz);
96 void AddInstanceMat4(const Float_t* mat4);
97
98 void AddCone(const REveVector& pos, const REveVector& dir, Float_t r);
99 void AddEllipticCone(const REveVector& pos, const REveVector& dir, Float_t r, Float_t r2, Float_t angle=0);
100
101 void AddHex(const REveVector& pos, Float_t r, Float_t angle, Float_t depth);
102
105
106 void ComputeBBox() override;
107
108 void Test(Int_t nboxes);
109
110 // The size of a kBT_Instanced box, full or half.
111 Float_t GetDefWidth() const { return 2 * fDefHalfWidth; }
112 Float_t GetDefHeight() const { return 2 * fDefHalfHeight; }
113 Float_t GetDefDepth() const { return 2 * fDefHalfDepth; }
117
118 void SetDefWidth(Float_t v) { fDefHalfWidth = 0.5f * v; }
120 void SetDefDepth(Float_t v) { fDefHalfDepth = 0.5f * v; }
124
127 {
128 fDrawConeCap = x;
130 }
131
132 Int_t GetBoxSkip() const { return fBoxSkip; }
133 void SetBoxSkip(Int_t bs) { fBoxSkip = bs; }
134
135 Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override;
136 void BuildRenderData() override;
137
138 bool Instanced();
139};
140
141} // namespace Experimental
142} // namespace ROOT
143#endif
#define d(i)
Definition RSha256.hxx:102
#define h(i)
Definition RSha256.hxx:106
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:72
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
Option_t Option_t TPoint TPoint angle
void AddInstanceMat4(const Float_t *mat4)
Create shape with arbitrary transformtaion.
void AddEllipticCone(const REveVector &pos, const REveVector &dir, Float_t r, Float_t r2, Float_t angle=0)
Create a cone with apex at pos, axis dir and radius r.
void AddFreeBox(const Float_t *verts)
EInstanceShape_e GetInstanceShape() const
void ComputeBBox() override
Fill the bounding box (virtual from REveElement).
void SetInstanceShape(EInstanceShape_e s)
void AddInstanceCorner(Float_t x, Float_t y, Float_t z)
Create a new axis-aligned box with lower corner (x, y, z) and the default size, see SetDefWidth() and...
void AddBox(const Float_t *verts)
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Fill core part of JSON representation.
void WriteShapeData(REveDigitSet::DigitBase_t &digit, REveRenderData::Entry &entry)
Append the shape of digit to entry, its render data entry: pos for kBT_Vertices and inst for the inst...
void BuildRenderData() override
Write the render data entries, see the class description: inst for the instanced types,...
REveBoxSet(const REveBoxSet &)=delete
void Test(Int_t nboxes)
Fill the structure with a random set of boxes.
void AddCone(const REveVector &pos, const REveVector &dir, Float_t r)
Create a cone with apex at pos, axis dir and radius r.
void Reset()
Reset the data containers to zero size.
void InstanceHalfSize(const DigitBase_t &digit, Float_t half[3]) const
Half size of an axis-aligned instance, kBT_Instanced or kBT_InstancedScaled, as the client draws it.
EInstanceShape_e fInstanceShape
void Reset(EBoxType_e boxType, Bool_t valIsCol, Int_t chunkSize)
void AddVertices(const Float_t *verts)
Create a new box from a set of 8 vertices.
void AddInstanceScaled(Float_t cx, Float_t cy, Float_t cz, Float_t hw, Float_t hh, Float_t hd)
Create a new axis-aligned box with centre (cx, cy, cz) and half size (hw, hh, hd).
REveBoxSet & operator=(const REveBoxSet &)=delete
void AddHex(const REveVector &pos, Float_t r, Float_t angle, Float_t depth)
Create a hexagonal prism with center of one hexagon at pos, radius of hexagon vertices r,...
unsigned int GetColorFromDigit(REveDigitSet::DigitBase_t &digit)
Get int value for color.
float GetColorFromDigitAsFloat(REveDigitSet::DigitBase_t &digit)
EInstanceShape_e
The shape every instance of a kBT_Instanced* box set draws.
static Int_t SizeofAtom(EBoxType_e bt)
Return size of data-structure describing a box of type bt.
bool Instanced()
Every box type except kBT_Vertices is drawn by instancing.
void AddInstance(Float_t cx, Float_t cy, Float_t cz)
Create a new axis-aligned box with centre (cx, cy, cz) and the default size, see SetDefWidth() and Se...
void AddInstanceScaledCorner(Float_t x, Float_t y, Float_t z, Float_t w, Float_t h, Float_t d)
Create a new axis-aligned box with lower corner (x, y, z) and size (w, h, d).
Geometrical transformation package.
Definition TGeoMatrix.h:39
This is the base class for the ROOT Random number generators.
Definition TRandom.h:28
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16