ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
gltf3.C
Go to the documentation of this file.
1 // Draws the Klein bottle.
2 // Klein bottle is closed nonorientable surface that has no inside or
3 // outside. TF3 can be drawn in several styles:
4 // default - like surface4
5 // kMaple0 - very nice colours
6 // kMaple1 - nice colours and outlines
7 // kMaple2 - nice colour outlines.
8 // To switch between them, you can press 's' key.
9 // Author: Timur Pocheptsov
10 
11 void gltf3()
12 {
14  TCanvas *cnv = new TCanvas("glc", "TF3: Klein bottle", 200, 10, 600, 600);
15  // TCanvas *cnv = new TCanvas("glc", "TF3: Torus", 200, 10, 600, 600);
16 
17  TPaveLabel *title = new TPaveLabel(0.04, 0.86, 0.96, 0.98,
18  "\"gl\" option for TF3. Select plot and press 's' to change the color.");
19  title->SetFillColor(32);
20  title->Draw();
21 
22  TPad *tf3Pad = new TPad("box", "box", 0.04, 0.04, 0.96, 0.8);
23  tf3Pad->Draw();
24 
25  TFormula f1 = TFormula("f1", "x*x + y*y + z*z + 2*y - 1");
26  TFormula f2 = TFormula("f2", "x*x + y*y + z*z - 2*y - 1");
27 
28  // Klein bottle with cutted top&bottom parts
29  // The Klein bottle is a closed nonorientable surface that has no
30  // inside or outside.
31 
32  TF3 *tf3 = new TF3("Klein Bottle","f1*(f2*f2-8*z*z) + 16*x*z*f2",
33  -3.5, 3.5, -3.5, 3.5, -2.5, 2.5);
34  // Torus
35  // TF3 *tf3 = new TF3("Torus","4*(x^4 +
36  // (y^2+z^2)^2)+17*x^2*(y^2+z^2)-20*(x^2+y^2+z^2)+17", -2.5., 2.5.,
37  // -2.5., 2.5., -2.5., 2.5.);
38 
39  tf3->SetFillColor(kRed);
40  tf3Pad->cd();
41  tf3->Draw("gl");
42 }
virtual void Draw(Option_t *option="")
Draw this function with its current attributes.
Definition: TF3.cxx:174
void gltf3()
Definition: gltf3.C:11
Definition: Rtypes.h:61
R__EXTERN TStyle * gStyle
Definition: TStyle.h:423
tuple f2
Definition: surfaces.py:24
TVirtualPad * cd(Int_t subpadnumber=0)
Set Current pad.
Definition: TPad.cxx:514
virtual void Draw(Option_t *option="")
Draw Pad in Current pad (re-parent pad if necessary).
Definition: TPad.cxx:1192
void SetCanvasPreferGL(Bool_t prefer=kTRUE)
Definition: TStyle.h:337
A Pave (see TPave) with a text centered in the Pave.
Definition: TPaveLabel.h:32
TPaveLabel title(3, 27.1, 15, 28.7,"ROOT Environment and Tools")
virtual void SetFillColor(Color_t fcolor)
Definition: TAttFill.h:50
A 3-Dim function with parameters.
Definition: TF3.h:30
The F O R M U L A class.
Definition: TFormula.h:89
The most important graphics class in the ROOT system.
Definition: TPad.h:46
The Canvas class.
Definition: TCanvas.h:48
virtual void Draw(Option_t *option="")
Draw this pavelabel with its current attributes.
Definition: TPaveLabel.cxx:77
TF1 * f1
Definition: legend1.C:11