Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
boxset_cones.C File Reference

Detailed Description

Demonstrates usage of 'cone' mode in REveBoxSet class.

using namespace ROOT::Experimental;
REveBoxSet* elliptic_boxset_cones(Float_t x=0, Float_t y=0, Float_t z=0,
Int_t num=100)
{
auto eveMng = REveManager::Create();
using namespace TMath;
REveManager::Create();
auto lines = new REveStraightLineSet("StraightLines");
lines->SetLineColor(kYellow);
lines->SetLineWidth(2);
TRandom r(0);
auto cones = new REveBoxSet("EllipticConeSet");
bool valIsColor = true;
cones->Reset(REveBoxSet::kBT_InstancedScaledRotated, valIsColor, 64);
cones->SetPickable(kTRUE);
Float_t a = 40; // max distance between cones
REveVector dir, pos;
Float_t theta, phi, height, rad;
for (Int_t i=0; i<num; ++i) {
theta = r.Uniform(0,TMath::Pi());
phi = r.Uniform (-TMath::Pi(), TMath::Pi());
height = r.Uniform(5, 15);
rad = r.Uniform(3, 5);
dir.Set(Cos(phi)*Cos(theta), Sin(phi)*Cos(theta), Sin(theta));
dir *= height;
pos.Set(r.Uniform(-a,a), r.Uniform(-a, a), r.Uniform(-a, a));
cones->AddEllipticCone(pos, dir, rad, 0.5*rad, r.Uniform(0,360));
if (i %2 == 0)
cones->DigitColor(kRed);
else
cones->DigitColor(kGreen);
// draw axis line 30% longer than cone height
REveVector end = pos + dir*1.3f;
lines->AddLine(pos.fX, pos.fY, pos.fZ, end.fX, end.fY, end.fZ);
}
// by default cone cap not drawn
if (r.Integer(2)>0) cones->SetDrawConeCap(kTRUE);
cones->RefitPlex();
REveTrans& t = cones->RefMainTrans();
t.SetPos(x, y, z);
cones->SetPickable(1);
cones->SetAlwaysSecSelect(1);
v->SetAxesType(REveViewer::kAxesOrigin);
return cones;
}
REveBoxSet* boxset_cones(Float_t x=0, Float_t y=0, Float_t z=0,
Int_t num=100)
{
auto eveMng = REveManager::Create();
using namespace TMath;
auto lines = new REveStraightLineSet("StraightLines");
lines->SetLineColor(kYellow);
lines->SetLineWidth(2);
TRandom r(0);
auto pal = new REveRGBAPalette(0, 500);
auto cones = new REveBoxSet("ConeSet");
cones->SetPalette(pal);
bool valIsColor = false;
cones->Reset(REveBoxSet::kBT_InstancedScaledRotated, valIsColor, 64);
Float_t a = 40; // max distance between cones
REveVector dir, pos;
Float_t theta, phi, height, rad;
for (Int_t i=0; i<num; ++i) {
theta = r.Uniform(0,TMath::Pi());
phi = r.Uniform (-TMath::Pi(), TMath::Pi());
height = r.Uniform(5, 15);
rad = r.Uniform(3, 5);
dir.Set(Cos(phi)*Cos(theta), Sin(phi)*Cos(theta), Sin(theta));
dir *= height;
pos.Set(r.Uniform(-a,a), r.Uniform(-a, a), r.Uniform(-a, a));
cones->AddCone(pos, dir, rad);
cones->DigitValue(r.Uniform(0, 500));
// draw axis line 30% longer than cone height
REveVector end = pos + dir*1.3f;
lines->AddLine(pos.fX, pos.fY, pos.fZ, end.fX, end.fY, end.fZ);
}
cones->SetPickable(1);
cones->SetAlwaysSecSelect(1);
// by default cone cap not drawn
if (r.Integer(2)>0) cones->SetDrawConeCap(kTRUE);
cones->RefitPlex();
REveTrans& t = cones->RefMainTrans();
t.SetPos(x, y, z);
return cones;
}
#define a(i)
Definition RSha256.hxx:99
int Int_t
Definition RtypesCore.h:45
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
@ kRed
Definition Rtypes.h:66
@ kGreen
Definition Rtypes.h:66
@ kYellow
Definition Rtypes.h:66
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 const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
Collection of 3D primitives (fixed-size boxes, boxes of different sizes, or arbitrary sexto-epipeds,...
A generic, speed-optimised mapping from value to RGBA color supporting different wrapping and range t...
REveTrans is a 4x4 transformation matrix for homogeneous coordinates stored internally in a column-ma...
Eve representation of a GL view.
virtual void AddElement(REveElement *el)
Add el to the list of children.
REveElement * FirstChild() const
Returns the first child element or 0 if the list is empty.
REveScene * GetEventScene() const
REveViewerList * GetViewers() const
void Show(const RWebDisplayArgs &args="")
Show eve manager in specified browser.
REveStraightLineSet Set of straight lines with optional markers along the lines.
void Set(const Float_t *v)
This is the base class for the ROOT Random number generators.
Definition TRandom.h:27
ROOT::Experimental::REveManager * eveMng
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
TMath.
Definition TMathBase.h:35
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Definition TMath.h:594
constexpr Double_t Pi()
Definition TMath.h:37
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Definition TMath.h:588
Author
Alja Mrak-Tadel

Definition in file boxset_cones.C.