basic3d.C

Go to the documentation of this file.
00001 {
00002    // Show 3-D polylines and markers
00003    // To see the output of this macro, click begin_html <a href="gif/basic3d.gif">here</a> end_html
00004    //
00005    gROOT->Reset();
00006    c1 = new TCanvas("c1","PolyLine3D & PolyMarker3D Window",200,10,700,500);
00007 
00008    // create a pad
00009    p1 = new TPad("p1","p1",0.05,0.02,0.95,0.82,46,3,1);
00010    p1->Draw();
00011    p1->cd();
00012 
00013    // creating a view
00014    view = TView::CreateView(1);
00015    view->SetRange(5,5,5,25,25,25);
00016 
00017    // create a first PolyLine3D
00018    TPolyLine3D *pl3d1 = new TPolyLine3D(5);
00019 
00020    // set points
00021    pl3d1->SetPoint(0, 10, 10, 10);
00022    pl3d1->SetPoint(1, 15, 15, 10);
00023    pl3d1->SetPoint(2, 20, 15, 15);
00024    pl3d1->SetPoint(3, 20, 20, 20);
00025    pl3d1->SetPoint(4, 10, 10, 20);
00026    // set attributes
00027    pl3d1->SetLineWidth(3);
00028    pl3d1->SetLineColor(5);
00029 
00030    // create a second PolyLine3D
00031    TPolyLine3D *pl3d2 = new TPolyLine3D(4);
00032 
00033    // set points
00034    pl3d2->SetPoint(0, 5, 10, 5);
00035    pl3d2->SetPoint(1, 10, 15, 8);
00036    pl3d2->SetPoint(2, 15, 15, 18);
00037    pl3d2->SetPoint(3, 5, 20, 20);
00038    pl3d2->SetPoint(4, 10, 10, 5);
00039 
00040    // set attributes
00041    pl3d2->SetLineWidth(5);
00042    pl3d2->SetLineColor(2);
00043 
00044    // create a first PolyMarker3D
00045    TPolyMarker3D *pm3d1 = new TPolyMarker3D(12);
00046 
00047    // set points
00048    pm3d1->SetPoint(0, 10, 10, 10);
00049    pm3d1->SetPoint(1, 11, 15, 11);
00050    pm3d1->SetPoint(2, 12, 15, 9);
00051    pm3d1->SetPoint(3, 13, 17, 20);
00052    pm3d1->SetPoint(4, 14, 16, 15);
00053    pm3d1->SetPoint(5, 15, 20, 15);
00054    pm3d1->SetPoint(6, 16, 18, 10);
00055    pm3d1->SetPoint(7, 17, 15, 10);
00056    pm3d1->SetPoint(8, 18, 22, 15);
00057    pm3d1->SetPoint(9, 19, 28, 25);
00058    pm3d1->SetPoint(10, 20, 12, 15);
00059    pm3d1->SetPoint(11, 21, 12, 15);
00060 
00061    // set marker size, color & style
00062    pm3d1->SetMarkerSize(2);
00063    pm3d1->SetMarkerColor(4);
00064    pm3d1->SetMarkerStyle(2);
00065 
00066    // create a second PolyMarker3D
00067    TPolyMarker3D *pm3d2 = new TPolyMarker3D(8);
00068 
00069    pm3d2->SetPoint(0, 22, 15, 15);
00070    pm3d2->SetPoint(1, 23, 18, 21);
00071    pm3d2->SetPoint(2, 24, 26, 13);
00072    pm3d2->SetPoint(3, 25, 17, 15);
00073    pm3d2->SetPoint(4, 26, 20, 15);
00074    pm3d2->SetPoint(5, 27, 15, 18);
00075    pm3d2->SetPoint(6, 28, 20, 10);
00076    pm3d2->SetPoint(7, 29, 20, 20);
00077 
00078    // set marker size, color & style
00079    pm3d2->SetMarkerSize(2);
00080    pm3d2->SetMarkerColor(1);
00081    pm3d2->SetMarkerStyle(8);
00082 
00083    // draw
00084    pl3d1->Draw();
00085    pl3d2->Draw();
00086    pm3d1->Draw();
00087    pm3d2->Draw();
00088    //
00089    // draw a title/explanation in the canvas pad
00090    c1->cd();
00091    TPaveText *title = new TPaveText(0.1,0.85,0.9,0.97);
00092    title->SetFillColor(24);
00093    title->AddText("Examples of 3-D primitives");
00094    TText *click=title->AddText("Click anywhere on the picture to rotate");
00095    click->SetTextColor(4);
00096    title->Draw();
00097 }

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