In the following small macro, I create 2 shapes of type TBRIK, the
second shape displaced by 40 in the y coordinate with respect to the 1st
shape. Then I create a point, "local", of coordinates (0,0,0) in the
system of the second shape, and I use TNode::Local2Master(local,master)
to try to get the coordinates in the master reference system of shape 1.
I hoped to get the coordinates (0,40,0), but I get (0,0,0) [ master[1]
is equal to 0 ] ! Does somebody understand why ?
I have looked at the code of Local2Master and I confess that I do not
understand how the translation vector is obtained, using this strange
code :
Double_t *translation = &gTranslation[gGeomLevel][0];
Why is the translation vector not obtained by using the fParent data
member ?
Code of the sample macro : (is also attached as a separate file to this
mail)
{
gROOT->Reset();
c1 = new TCanvas("c1","Geometry Shapes",200,10,700,500);
// Define some volumes
brik = new TBRIK("BRIK","BRIK","void",15,15,15);
bri2 = new TBRIK("BRI2","BRI2","void",15,15,15);
// Set shapes attributes
brik->SetLineColor(1);
bri2->SetLineColor(4);
// Build the geometry hierarchy
TNode *node1;
node1 = new TNode("NODE1","NODE1","BRIK");
node1->cd();
TNode *node2;
node2 = new TNode("NODE2","NODE2","BRI2",0,40,0);
// Draw this geometry in the current canvas
node1->cd();
node1->Draw();
c1->Update();
//Here, something is wrong ?
Double_t *local,*master;
local = new Double_t[3];
master = new Double_t[3];
local[0] = 0;
local[1] = 0;
local[2] = 0;
node2->Local2Master(local,master);
}
Francois-Xavier Gentit
CEA DAPNIA/SPP
tel 01 69 08 30 38
--Emailer_-1309233403
Content-Type: application/mac-binhex40; name="test2.C"
(This file must be converted with BinHex 4.0)
:"h4PFh3b,N-!9%9B9(4dH(3"!!!!!`J!!!&-[S4l$5!J)'G56dp8,6j5CA0PG#J
T1`dJ)#"M-5!p)'jPGb"83f&ZGQ&c+#*M-5)X)NGPEfePG(*j)&0SBA"PFb)X-M!
`,$%`,$F`-#`e-$!T1`d0,bmJ)%4PCQPZC5"cEfeP)(C[E(9YCA-0)#!JBR*TDb!
p)'jPGb"83P**5bJL3P**5b)X)N*558XL,#*fEfPN)L`a05`a05`a05Nl$5!J)'*
bD6)J25"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