#include "TCanvas.h" #include "TView.h" #include "TPad.h" #include "TH1D.h" #include "TPolyLine3D.h" void easy2() { // create two diffrent objects to be displayed - a polyline and a histogram double x[6] = {-14.37, 14.37, +25.53, 0., -25.53, -14.37}; double y[6] = {-11.11, -11.11, 0., +25.53, 0., -11.11}; double z[6] = {0, 0, 0, 0, 0, 0}; TPolyLine3D *det1 = new TPolyLine3D(6, z, x, y); TH1D* det2 = new TH1D("det1", "det1", 100, 0, 1); // create a canvas with pads TCanvas *c = new TCanvas(); c->Divide(2, 2); // 1. user decides to display the polyline in pad 3 c->cd(3); TView *view; view = TView::CreateView(1, 0, 0); view->SetRange(-10, -35, -21, 50, 35, 35); view->SetPerspective(); det1->Draw(); // 2. user changes his mind and displays the histogram in pad3 c->Clear("d"); // to clear the contents of pads c->cd(3); det2->Draw(); // 3. users again decides to display the polyline c->Clear("d"); c->cd(3); det1->Draw(); // here we get the problem printf("OK, finishing\n"); }