gltf3.C

Go to the documentation of this file.
00001 // Draws the Klein bottle.
00002 // Klein bottle is closed nonorientable surface that has no inside or
00003 // outside. TF3 can be drawn in several styles:
00004 //   default - like surface4
00005 //   kMaple0 - very nice colours
00006 //   kMaple1 - nice colours and outlines
00007 //   kMaple2 - nice colour outlines.
00008 // To switch between them, you can press 's' key.
00009 // Author: Timur Pocheptsov
00010 
00011 void gltf3()
00012 {
00013    gStyle->SetCanvasPreferGL(1);
00014    TCanvas *cnv = new TCanvas("glc", "TF3: Klein bottle", 200, 10, 600, 600);
00015    // TCanvas *cnv = new TCanvas("glc", "TF3: Torus", 200, 10, 600, 600);
00016 
00017    TPaveLabel *title = new TPaveLabel(0.04, 0.86, 0.96, 0.98,
00018       "\"gl\" option for TF3. Select plot and press 's' to change the color.");
00019    title->SetFillColor(32);
00020    title->Draw();
00021 
00022    TPad *tf3Pad  = new TPad("box", "box", 0.04, 0.04, 0.96, 0.8);   
00023    tf3Pad->Draw();
00024 
00025    TFormula f1 = TFormula("f1", "x*x + y*y + z*z + 2*y - 1");
00026    TFormula f2 = TFormula("f2", "x*x + y*y + z*z - 2*y - 1");
00027 
00028    // Klein bottle with cutted top&bottom parts
00029    // The Klein bottle is a closed nonorientable surface that has no
00030    // inside or outside.
00031 
00032    TF3 *tf3 = new TF3("Klein Bottle","f1*(f2*f2-8*z*z) + 16*x*z*f2",
00033                       -3.5, 3.5, -3.5, 3.5, -2.5, 2.5);
00034    // Torus
00035    // TF3 *tf3 = new TF3("Torus","4*(x^4 +
00036    // (y^2+z^2)^2)+17*x^2*(y^2+z^2)-20*(x^2+y^2+z^2)+17", -2.5., 2.5.,
00037    // -2.5., 2.5., -2.5., 2.5.);
00038 
00039    tf3->SetFillColor(kRed);
00040    tf3Pad->cd();
00041    tf3->Draw("gl");
00042 }

Generated on Tue Jul 5 15:44:17 2011 for ROOT_528-00b_version by  doxygen 1.5.1