ROOT
Version master
master
v6.34
v6.32
v6.30
v6.28
v6.26
v6.24
v6.22
v6.20
v6.18
v6.16
v6.14
v6.12
v6.10
v6.08
v6.06
v6.04
Reference Guide
►
ROOT
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
Loading...
Searching...
No Matches
tornado.C
Go to the documentation of this file.
1
/// \file
2
/// \ingroup tutorial_graphics
3
/// \notebook
4
/// Show 3-d polymarker.
5
///
6
/// \macro_image
7
/// \macro_code
8
///
9
/// \author Rene Brun
10
11
void
tornado
()
12
{
13
gBenchmark
->
Start
(
"tornado"
);
14
15
double
PI
= 3.141592653;
16
int
d
= 16;
17
int
numberOfPoints
= 200;
18
int
numberOfCircles
= 40;
19
20
// create and open a canvas
21
TCanvas
*
sky
=
new
TCanvas
(
"sky"
,
"Tornado"
, 300, 10, 700, 500);
22
sky
->SetFillColor(14);
23
24
// creating view
25
TView
*view =
TView::CreateView
(1, 0, 0);
26
float
range
=
numberOfCircles
*
d
;
27
view->
SetRange
(0, 0, 0, 4.0 *
range
, 2.0 *
range
,
range
);
28
29
for
(
int
j
=
d
;
j
<
numberOfCircles
*
d
;
j
+=
d
) {
30
31
// create a PolyMarker3D
32
TPolyMarker3D
*
pm3d
=
new
TPolyMarker3D
(
numberOfPoints
);
33
34
float
x
,
y
, z;
35
36
// set points
37
for
(
int
i = 1; i <
numberOfPoints
; i++) {
38
float
csin
= sin(2 *
PI
/ (
double
)
numberOfPoints
* (
double
)i) + 1;
39
float
ccos
= cos(2 *
PI
/ (
double
)
numberOfPoints
* (
double
)i) + 1;
40
float
esin
= sin(2 *
PI
/ (
double
)(
numberOfCircles
*
d
) * (
double
)
j
) + 1;
41
x
=
j
* (
csin
+
esin
);
42
y
=
j
*
ccos
;
43
z =
j
;
44
pm3d
->SetPoint(i,
x
,
y
, z);
45
}
46
47
// set marker size, color & style
48
pm3d
->SetMarkerSize(1);
49
pm3d
->SetMarkerColor(2 + (
d
== (
j
&
d
)));
50
pm3d
->SetMarkerStyle(3);
51
52
// draw
53
pm3d
->Draw();
54
}
55
56
char
timeStr
[60];
57
gBenchmark
->
Show
(
"tornado"
);
58
59
Float_t
ct
=
gBenchmark
->
GetCpuTime
(
"tornado"
);
60
sprintf
(
timeStr
,
"Execution time: %g sec."
,
ct
);
61
62
TPaveText
*
text
=
new
TPaveText
(0.1, 0.81, 0.9, 0.97);
63
text
->SetFillColor(42);
64
text
->AddText(
"ROOT example: tornado.C"
);
65
text
->AddText(
timeStr
);
66
text
->Draw();
67
sky
->Update();
68
}
d
#define d(i)
Definition
RSha256.hxx:102
Float_t
float Float_t
Definition
RtypesCore.h:57
PI
#define PI
Definition
SpecFuncMathCore.cxx:23
gBenchmark
R__EXTERN TBenchmark * gBenchmark
Definition
TBenchmark.h:59
TRangeDynCast
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Definition
TCollection.h:358
text
Option_t Option_t TPoint TPoint const char text
Definition
TGWin32VirtualXProxy.cxx:68
ROOT::Detail::TRangeCast
Definition
TCollection.h:311
TBenchmark::Start
virtual void Start(const char *name)
Starts Benchmark with the specified name.
Definition
TBenchmark.cxx:172
TBenchmark::Show
virtual void Show(const char *name)
Stops Benchmark name and Prints results.
Definition
TBenchmark.cxx:155
TBenchmark::GetCpuTime
Float_t GetCpuTime(const char *name)
Returns Cpu time used by Benchmark name.
Definition
TBenchmark.cxx:117
TCanvas
The Canvas class.
Definition
TCanvas.h:23
TPaveText
A Pave (see TPave) with text, lines or/and boxes inside.
Definition
TPaveText.h:21
TPolyMarker3D
A 3D polymarker.
Definition
TPolyMarker3D.h:33
TView
See TView3D.
Definition
TView.h:25
TView::CreateView
static TView * CreateView(Int_t system=1, const Double_t *rmin=nullptr, const Double_t *rmax=nullptr)
Create a concrete default 3-d view via the plug-in manager.
Definition
TView.cxx:27
TView::SetRange
virtual void SetRange(const Double_t *min, const Double_t *max)=0
y
Double_t y[n]
Definition
legend1.C:17
x
Double_t x[n]
Definition
legend1.C:17
tornado
Definition
tornado.py:1
tutorials
visualisation
graphics
tornado.C
ROOT master - Reference Guide Generated on Thu Jan 30 2025 12:41:59 (GVA Time) using Doxygen 1.10.0