Hi Michael, I still had this old macro laying around that shows how to draw polyline3d's in a TView. And if you uncomment the TBRIK stuff you also get the brik. Cheers, Fons. void massimo( int numberOfPoints = 10, float range = 100.0 ) { gROOT->Reset(); TStopwatch timer; timer.Start(); TCanvas *c1 = gROOT->FindObject( "c1" ); if ( c1 ) c1->Delete(); // create and open the default canvas TCanvas *c1 = new TCanvas( "c1" ); // create a view and set the range TView *view = new TView( 1 ); view->SetRange( -110, -110, -110, range, range, range ); // create a PolyMarker3D TPolyMarker3D *pm3d = new TPolyMarker3D( numberOfPoints ); // create a PolyLine3D TPolyLine3D *pl3d = new TPolyLine3D( numberOfPoints ); // set the points for( int i = 0; i < numberOfPoints; i++ ) { float x = fmod( (double) rand(), (double) range ); float y = fmod( (double) rand(), (double) range ); float z = fmod( (double) rand(), (double) range ); pm3d->SetPoint( i, x, y, z ); pl3d->SetPoint( i, x, y, z ); } // set the marker size, color & style pm3d->SetMarkerSize( 2 ); pm3d->SetMarkerColor( 5 ); pm3d->SetMarkerStyle( 4 ); // set the line color & style pl3d->SetLineColor( 6 ); //draw pm3d->Draw(); pl3d->Draw(); /* // Define some volumes TBRIK *brik = new TBRIK( "BRIK", "BRIK", "void", 10, 20, 30 ); // Set shapes attributes brik->SetLineColor( 2 ); // Build the geometry hierarchy TNode *node1 = new TNode( "NODE1", "NODE1", "BRIK", 30, 30, 30 ); // Draw this geometry in the current canvas node1->Draw("same"); c1->Update(); */ TPaveText *text = new TPaveText( 0.1, 0.81, 0.9, 0.97 ); text->SetFillColor( 24 ); text->AddText("ROOT example: massimo.C"); char timeStr[60]; sprintf( timeStr, "Number of points: %d", numberOfPoints ); text->AddText(timeStr); sprintf( timeStr, "Execution time: %g sec.", timer.CpuTime() ); text->AddText(timeStr); text.Draw(); } Michael Katz-Hyman wrote: > > When I input the following commands into the root interpreter, nothing > happens, or at least from all i can tell, am i doing something horribly > wrong with TPolylLine3D? > > Mike > > // code > > CINT/ROOT C/C++ Interpreter version 5.13.83, Dec 2 1998 > Type ? for help. Commands must be C++ statements. > Enclose multiple statements between { }. > root [0] new TCanvas("c","c",500,500) > (class TCanvas*)0x84c9968 > root [1] TPolyLine3D track(2); > root [2] track.SetPoint(0,0,0,0); > root [3] track.SetPoint(1,20,20,20); > root [4] track.Draw(); > root [5] > > // end code -- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland E-Mail: Fons.Rademakers@cern.ch Phone: +41 22 7679248 WWW: http://root.cern.ch/~rdm/ Fax: +41 22 7677910
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:36 MET