[ROOT] Possible bug?

From: Mike Miller (miller@star.physics.yale.edu)
Date: Thu Jun 21 2001 - 22:03:26 MEST


Hello, I'm trying to draw a TPolyMarker3D on top of a set of TVolumes.  I
do this to draw a set of hits on top of a simple detector model.  If I
draw the TVolume, the TPolyMarker3D, the TVolume agiain, I'm ok.  If I
draw the TVolume, TPolyMarker3D, TVolume agiain, TPolyMarker3D again, I
seg-fault.  In this example I wouldn't need to draw the TVolume multiple
times, it is simply meant to illustrate the point.  However, in the real
application, I do need to call TVolume::Draw() more than once to refresh
changes in the display.

Here's the macro...

void TestShapes()
{
    gSystem->Load("libstar");
    TCanvas* c1 = new TCanvas("c1");

    TVolume* main = new TVolume();

    TBRIK* brik = new TBRIK("BRIK","BRIK","void", 10., 20., 30.);
    TVolume* son = new TVolume("son","son",brik);

    main->Add(son);

    cout <<"Draw Main Volume"<<endl;
    main->Draw();
    c1->Update();
    
    main->SetVisibility(TVolume::kBothVisible);

    cout <<"Starting Loop To Fill Array"<<endl;
    double* x = new double[9];
    for (int i=0; i<9; ++i) {
	x[i]=static_cast<double>(i);
    }

    for (int i=0; i<9; ++i) {
	cout <<i<<"\t"<<x[i]<<endl;
    }
    
    TPolyMarker3D* poly = new TPolyMarker3D(9, x, 8);
    cout <<"Draw TPolyMarker3D"<<endl;
    poly->Draw();
    cout <<"Draw TPolyMarker3D Again"<<endl;
    poly->Draw();
    cout <<"Draw Main Volume Again"<<endl;
    main->Draw();
    cout <<"Update Canvas"<<endl;
    c1->Update();

    //This is where we seg-fault
    cout <<"Draw TPolyMarker3D Again"<<endl;
    poly->Draw();
    
    return;
}

How else can I represent points in an inexpensive 3d fashion?  Thanks,
Mike

Michael L. Miller
Yale Physics
michael.miller@yale.edu

BNL: 	(631) 344-8342
	Building 118
	Yale Software

Yale:   (203) 432-5637
	Room 305 WNSL



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:50 MET