Re: Axis for TNode.

Rene Brun (Rene.Brun@cern.ch)
Fri, 02 Oct 1998 16:47:13 +0200


Alexander Zvyagin wrote:
>
> Date: Fri, 2 Oct 1998 09:19:49 +0000
> From: Alexander Zvyagin <ZVYAGIN@mx.ihep.su>
> X-Sender: ZVYAGIN@polar.ihep.su
> To: roottalk@hpsalo.cern.ch
> Subject: Axis for TNode.
> Message-ID: <Pine.VMS.3.91-b11-vms.981002091104.2198A-100000@polar.ihep.su>
> MIME-Version: 1.0
> Content-Type: TEXT/PLAIN; charset=US-ASCII
>
> Dear ROOTers!
>
> I'd like to draw axis on my TNode. (I mean I would like to have axis drawn
> when I call function TNode::Draw() in CINT.)
> What is the simples way to do this?
>
> May be it will be good to add 'axis feature' in the TNode/TShape class?
>
> With best wishes,
> Alexander.

Alex,
I don't think this should be part of TNode/TShape, but an
independent small class. Meanwhile (and for fun) you can get
some inspiration for one (or both) macros below:

Rene Brun

//==============simple axis.C

{
lx = new TPolyLine3D(2);
lx->SetLineColor(6);
lx->SetLineWidth(2);
lx->SetLineStyle(2);
lx->SetPoint(0,0,0,0);
lx->SetPoint(1,800,0,0);

ly = new TPolyLine3D(2);
ly->SetLineColor(4);
ly->SetLineStyle(2);
ly->SetLineWidth(2);
ly->SetPoint(0,0,0,0);
ly->SetPoint(1,0,800,0);

lz = new TPolyLine3D(2);
lz->SetLineColor(2);
lz->SetLineStyle(2);
lz->SetLineWidth(2);
lz->SetPoint(0,0,0,0);
lz->SetPoint(1,0,0,1200);
lx->Draw();
ly->Draw();
lz->Draw();
}

//==============funny axis.C by Stascek Jadach

{
// S. Jadach, arrows.C, truly 3-dim. reference system
gROOT->Reset();
c1 = new TCanvas("c1","Geometry Shapes",0,0,700,700);

brik = new TBRIK("BRIK","BRIK","void",1000,1000,1000);
cone = new TCONE("CONE","CONE","void", 200, 0,200, 0,0);
// +-z r1,rmax r1,rmax
tube = new TTUBE("TUBE","TUBE","void", 0,50,500);
cone->SetLineColor(1);
tube->SetLineColor(2);

//delete rot1;
TRotMatrix *rot1 = new TRotMatrix("rot1","rot1" ,90,90 ,0,0 ,90,0
);
// y z x
TRotMatrix *rot2 = new TRotMatrix("rot2","rot2" ,0,0 ,90,0
,90,90);
// y z x

// Build the geometry hierarchy
node1 = new TNode("NODE1","NODE1","BRIK");
node1->cd();
TNode *node2 = new TNode("NODE2","NODE2","TUBE", 500,0,0,"rot1");
node2->cd();
TNode *node3 = new TNode("NODE3","NODE3","CONE", 0, 0, 700,"");
node3->SetLineColor(6);

node1->cd();
TNode *node4 = new TNode("NODE4","NODE4","TUBE", 0, 0, 500);
node4->cd();
TNode *node5 = new TNode("NODE5","NODE5","CONE", 0, 0, 700);
node3->SetLineColor(4);

node1->cd();
TNode *node6 = new TNode("NODE6","NODE6","TUBE", 0, 500, 0,"rot2");
node6->cd();
TNode *node7 = new TNode("NODE7","NODE7","CONE", 0, 0, 700);
node7->SetLineColor(5);

// Draw this geometry in the current canvas
node1->cd();
node1->Draw();
node1->SetVisibility(0);
c1->Update();

pline3D = new TPolyLine3D(2,"");
pline3D->SetLineColor(7);
pline3D->SetLineWidth(2);
pline3D->SetPoint(0, 0,0,0);
pline3D->SetPoint(1, 1200,800,1000);
pline3D->Draw();

}