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
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:35 MET