00001
00002
00003 void glrose()
00004 {
00005
00006
00007 const Int_t paletteSize = 10;
00008 Float_t rgb[paletteSize * 3] =
00009 {0.80f, 0.55f, 0.40f,
00010 0.85f, 0.60f, 0.45f,
00011 0.90f, 0.65f, 0.50f,
00012 0.95f, 0.70f, 0.55f,
00013 1.f, 0.75f, 0.60f,
00014 1.f, 0.80f, 0.65f,
00015 1.f, 0.85f, 0.70f,
00016 1.f, 0.90f, 0.75f,
00017 1.f, 0.95f, 0.80f,
00018 1.f, 1.f, 0.85f};
00019
00020 Int_t palette[paletteSize] = {0};
00021
00022 for (Int_t i = 0; i < paletteSize; ++i)
00023 palette[i] = TColor::GetColor(rgb[i * 3], rgb[i * 3 + 1], rgb[i * 3 + 2]);
00024
00025 gStyle->SetPalette(paletteSize, palette);
00026
00027 gStyle->SetCanvasPreferGL(1);
00028 TCanvas *cnv = new TCanvas("glc", "Surface sample", 200, 10, 600, 550);
00029
00030 TPaveLabel *title = new TPaveLabel(0.04, 0.86, 0.96, 0.98,
00031 "\"glsurf2pol\" option + user defined palette.");
00032 title->SetFillColor(32);
00033 title->Draw();
00034
00035 TPad *rosePad = new TPad("box", "box", 0.04, 0.04, 0.96, 0.8);
00036 rosePad->Draw();
00037
00038
00039 TF2 *fun = new TF2("a", "cos(y)*sin(x)+cos(x)*sin(y)", -6, 6, -6, 6);
00040 fun->SetContour(paletteSize);
00041 fun->SetNpx(30);
00042 fun->SetNpy(30);
00043 rosePad->cd();
00044 fun->Draw("glsurf2pol");
00045 }