Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
gltf3.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_gl
3/// Draws the Klein bottle.
4/// Klein bottle is closed non-orientable surface that has no inside or
5/// outside. TF3 can be drawn in several styles:
6/// - default - like surface4
7/// - kMaple0 - very nice colours
8/// - kMaple1 - nice colours and outlines
9/// - kMaple2 - nice colour outlines.
10/// To switch between them, you can press 's' key.
11///
12/// \macro_image(nobatch)
13/// \macro_code
14///
15/// \author Timur Pocheptsov, Sergey Linev
16
17void gltf3(bool gl = true)
18{
20 TCanvas *cnv = new TCanvas("gltf3", "TF3: Klein bottle", 200, 10, 600, 600);
21 if (!cnv->UseGL() && !cnv->IsWeb())
22 ::Warning("gltf3",
23 "To use TF3 gl draw option, you need either OpenGL or Web rendering enabled");
24
25 TPaveLabel *title =
26 new TPaveLabel(0.04, 0.86, 0.96, 0.98, "\"gl\" option for TF3. Select plot and press 's' to change the color.");
27 title->SetFillColor(32);
28 title->Draw();
29
30 TPad *tf3Pad = new TPad("box", "box", 0.04, 0.04, 0.96, 0.8);
31 tf3Pad->Draw();
32
33 TFormula *f1 = new TFormula("f1", "x*x + y*y + z*z + 2*y - 1");
34 TFormula *f2 = new TFormula("f2", "x*x + y*y + z*z - 2*y - 1");
35
36 // Klein bottle with cut top&bottom parts
37 // The Klein bottle is a closed non-orientable surface that has no
38 // inside or outside.
39
40 TF3 *tf3 = new TF3("Klein Bottle", "f1*(f2*f2-8*z*z) + 16*x*z*f2", -3.5, 3.5, -3.5, 3.5, -2.5, 2.5);
41
42 tf3->SetFillColor(kRed);
43 tf3Pad->cd();
44 tf3->Draw("gl");
45}
@ kRed
Definition Rtypes.h:67
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition TError.cxx:252
R__EXTERN TStyle * gStyle
Definition TStyle.h:442
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition TAttFill.h:40
The Canvas class.
Definition TCanvas.h:23
TF3 defines a 3D Function with Parameters.
Definition TF3.h:28
The Formula class.
Definition TFormula.h:89
The most important graphics class in the ROOT system.
Definition TPad.h:28
A Pave (see TPave) with a text centered in the Pave.
Definition TPaveLabel.h:20
void Draw(Option_t *option="") override
Draw this pavelabel with its current attributes.
void SetCanvasPreferGL(Bool_t prefer=kTRUE)
Definition TStyle.h:345
TF1 * f1
Definition legend1.C:11