本文整理汇总了C++中TGeoVolume::AddNodeOverlap方法的典型用法代码示例。如果您正苦于以下问题:C++ TGeoVolume::AddNodeOverlap方法的具体用法?C++ TGeoVolume::AddNodeOverlap怎么用?C++ TGeoVolume::AddNodeOverlap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TGeoVolume
的用法示例。
在下文中一共展示了TGeoVolume::AddNodeOverlap方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: robot
void robot()
{
// Drawing a famous Korean robot, TaekwonV, using ROOT geometry class.
// Name: robot.C
// Author: Jin Hui Hwang, Dept. of Physics, Univ. of Seoul
// Reviewed by Sunman Kim ([email protected])
// Supervisor: Prof. Inkyu Park ([email protected])
//
// How to run: .x robot.C in ROOT terminal, then use OpenGL
//
// This macro was created for the evaluation of Computational Physics course in 2006.
// We thank to Prof. Inkyu Park for his special lecture on ROOT and to all of ROOT team
//
TGeoManager *Robot = new TGeoManager("Robot", "This is Taegwon V");
TGeoMaterial *vacuum = new TGeoMaterial("vacuum", 0, 0, 0);
TGeoMaterial *Fe = new TGeoMaterial("Fe", 55.845, 26, 7.87);
TGeoMedium *Air = new TGeoMedium("Vacuum", 0, vacuum);
TGeoMedium *Iron = new TGeoMedium("Iron", 1, Fe);
// create volume
TGeoVolume *top = Robot->MakeBox("top", Air, 1000, 1000, 1000);
Robot->SetTopVolume(top);
Robot->SetTopVisible(0);
// If you want to see the boundary, please input the number, 1 instead of 0.
// Like this, geom->SetTopVisible(1);
// head
TGeoVolume *Band = Robot->MakeEltu("Band", Iron, 20, 20, 2.5);
Band->SetLineColor(12);
Band->SetFillColor(12);
TGeoVolume *Band_b = Robot->MakeSphere("Band_b", Iron, 0, 2, 0, 180, 180, 360);
Band_b->SetLineColor(2);
Band_b->SetFillColor(2);
TGeoVolume *Head = Robot->MakeSphere("Head", Iron, 0, 19, 0, 180, 180, 360);
Head->SetLineColor(17);
Head->SetFillColor(17);
TGeoVolume *Horn = Robot->MakeSphere("Horn", Iron, 0, 10, 60, 180, 240, 300);
// drawing head
top->AddNodeOverlap(Band, 1, new TGeoTranslation(0, 0, 90));
float Phi = 3.14;
int N = 10;
for (int i = 0; i <= N; i++) {
top->AddNodeOverlap(Band_b, 1, new TGeoCombiTrans(sin(2 * Phi / N * i) * 19, -cos(2 * Phi / N * i) * 19, 90,
new TGeoRotation("R1", -90 + (360 / N * i), -90, 90)));
}
top->AddNodeOverlap(Head, 1, new TGeoCombiTrans(0, 0, 87.5, new TGeoRotation("R2", 0, -90, 0)));
char name[50];
float pcs = 30;
for (int i = 1; i < pcs; i++) {
sprintf(name, "Horn%d", i);
Horn = Robot->MakeSphere(name, Iron, 10 - 10 / pcs * i, 10, 180 - (120 / pcs) * i, 180 - ((120 / pcs) * (i - 1)),
240, 300);
Horn->SetLineColor(2);
Horn->SetFillColor(2);
top->AddNodeOverlap(Horn, 1, new TGeoCombiTrans(0, 8, 102, new TGeoRotation("R2", 0, 140, 0)));
top->AddNodeOverlap(Horn, 1, new TGeoCombiTrans(0, -8, 102, new TGeoRotation("R2", 180, 140, 0)));
}
// face
TGeoVolume *Migan = Robot->MakeGtra("Migan", Iron, 3, 0, 0, 0, 3, 2, 11, 0, 3, 3, 11, 0);
Migan->SetLineColor(17);
Migan->SetFillColor(17);
TGeoVolume *Ko = Robot->MakeGtra("Ko", Iron, 7, 0, 0, 0, 3, 1, 5, 0, 3, 2, 5, 0);
Ko->SetLineColor(17);
Ko->SetFillColor(17);
TGeoVolume *Ko_m = Robot->MakeBox("Ko_m", Iron, 2, 8, 4);
Ko_m->SetLineColor(17);
Ko_m->SetFillColor(17);
TGeoVolume *Bol_1 = Robot->MakeBox("Bol_1", Iron, 7, 5.5, 7);
Bol_1->SetLineColor(17);
Bol_1->SetFillColor(17);
TGeoVolume *Bol_2 = Robot->MakeGtra("Bol_2", Iron, 1, 0, 0, 0, 7, 0, 9, 0, 7, 0, 9, 0);
Bol_2->SetLineColor(17);
Bol_2->SetFillColor(17);
TGeoVolume *Noon = Robot->MakeBox("Noon", Iron, 1, 10, 5);
Noon->SetLineColor(12);
Noon->SetFillColor(12);
TGeoVolume *Tuck = Robot->MakeBox("Tuck", Iron, 2, 10, 5.5);
Tuck->SetLineColor(2);
Tuck->SetFillColor(2);
TGeoVolume *Tuck_1 = Robot->MakeBox("Tuck_1", Iron, 2, 9, 1);
Tuck_1->SetLineColor(2);
Tuck_1->SetFillColor(2);
TGeoVolume *Tuck_2 = Robot->MakeBox("Tuck_2", Iron, 3, 1, 14);
Tuck_2->SetLineColor(2);
Tuck_2->SetFillColor(2);
TGeoVolume *Tuck_j = Robot->MakeSphere("Tuck_j", Iron, 0, 3.5, 0, 180, 0, 360);
Tuck_j->SetLineColor(5);
Tuck_j->SetFillColor(5);
TGeoVolume *Ear = Robot->MakeCons("Ear", Iron, 1, 0, 3, 0, 3, 0, 360);
Ear->SetLineColor(5);
Ear->SetFillColor(5);
TGeoVolume *Ear_2 = Robot->MakeCone("Ear_2", Iron, 5, 0, 0, 0, 3);
//.........这里部分代码省略.........
示例2: south_gate
void south_gate()
{
// Drawing a famous Korean gate, the South gate, called Namdeamoon in Korean, using ROOT geometry class.
// Name: south_gate.C
// Author: Lan Hee Yang([email protected]), Dept. of Physics, Univ. of Seoul
// Reviewed by Sunman Kim ([email protected])
// Supervisor: Prof. Inkyu Park ([email protected])
//
// How to run: .x south_gate.C in ROOT terminal, then use OpenGL
//
// This macro was created for the evaluation of Computational Physics course in 2006.
// We thank to Prof. Inkyu Park for his special lecture on ROOT and to all of ROOT team
//
TGeoManager *geom=new TGeoManager("geom","My first 3D geometry");
TGeoMaterial *vacuum=new TGeoMaterial("vacuum",0,0,0);//a,z,rho
TGeoMaterial *Fe=new TGeoMaterial("Fe",55.845,26,7.87);
//Creat media
TGeoMedium *Air = new TGeoMedium("Vacuum",0,vacuum);
TGeoMedium *Iron = new TGeoMedium("Iron",1,Fe);
//Creat volume
TGeoVolume *top = geom->MakeBox("top",Air,1000,1000,1000);
geom->SetTopVolume(top);
geom->SetTopVisible(0);
// If you want to see the boundary, please input the number, 1 instead of 0.
// Like this, geom->SetTopVisible(1);
//base
char nBlocks[100];
int i=1;
int N = 0;
int f=0;
int di[2]; di[0] = 0; di[1] = 30;
TGeoVolume *mBlock;
while (f<11){
while (i<14){
if (i==6 && f<8){
i = i+3;
}
sprintf(nBlocks,"f%d_bg%d",f,N++);
mBlock = geom->MakeBox(nBlocks, Iron, 29,149,9);
mBlock->SetLineColor(20);
if (f<8){
if (i<=5 && f<8){
top->AddNodeOverlap(mBlock,1,new TGeoTranslation(-120-((i-1)*60)-di[f%2],5,5+(20*f)));
} else if (i>5 && f<8){
top->AddNodeOverlap(mBlock,1,new TGeoTranslation(120+((i-9)*60) +di[f%2],5,5+(20*f)));
}
} else {
top->AddNodeOverlap(mBlock,1,new TGeoTranslation(-420+(i*60)-di[f%2],5,5+(20*f)));
}
i++;
if (i>=14 && f>=8 && f%2 == 1){
sprintf(nBlocks,"f%d_bg%d",f,N++);
mBlock = geom->MakeBox(nBlocks, Iron, 29,149,9);
mBlock->SetLineColor(20);
top->AddNodeOverlap(mBlock,1,new TGeoTranslation(-420+(i*60)-di[f%2],5,5+(20*f)));
i++;
}
if (f%2 ==0){
sprintf(nBlocks,"f%d_bg%d",f,N++);
mBlock = geom->MakeBox(nBlocks, Iron, 14.5,149,9);
mBlock->SetLineColor(20);
top->AddNodeOverlap(mBlock,1,new TGeoTranslation(-405,5,5+(20*f)));
sprintf(nBlocks,"f%d_bg%d",f,N++);
mBlock = geom->MakeBox(nBlocks, Iron, 14.5,149,9);
mBlock->SetLineColor(20);
top->AddNodeOverlap(mBlock,1,new TGeoTranslation(405,5,5+(20*f)));
} else if (f<5){
sprintf(nBlocks,"f%d_bg%d",f,N++);
mBlock = geom->MakeBox(nBlocks, Iron, 14.5,149,9);
mBlock->SetLineColor(20);
top->AddNodeOverlap(mBlock,1,new TGeoTranslation(-105,5,5+(20*f)));
sprintf(nBlocks,"f%d_bg%d",f,N++);
mBlock = geom->MakeBox(nBlocks, Iron, 14.5,149,9);
mBlock->SetLineColor(20);
top->AddNodeOverlap(mBlock,1,new TGeoTranslation(105,5,5+(20*f)));
}
}
sprintf(nBlocks,"f%d_bg%d",8,N++);
mBlock = geom->MakeBox(nBlocks, Iron, 40,149,9);
mBlock->SetLineColor(20);
top->AddNodeOverlap(mBlock,1,new TGeoTranslation(-80,5,145));
sprintf(nBlocks,"f%d_bg%d",8,N++);
mBlock = geom->MakeBox(nBlocks, Iron, 40,149,9);
mBlock->SetLineColor(20);
top->AddNodeOverlap(mBlock,1,new TGeoTranslation(80,5,145));
sprintf(nBlocks,"f%d_bg%d",7,N++);
//.........这里部分代码省略.........