#include "TGeoManager.h" #include "TPolyMarker3D.h" #include "TPolyLine3D.h" void bug() { TGeoManager *mgr = new TGeoManager("manager", ""); //########################################################**MATERIALS**################################## TGeoMaterial *void_mat = new TGeoMaterial("void", 0, 0, 0); TGeoMedium *void_med = new TGeoMedium ("void", 1, void_mat); TGeoMaterial *steel_mat = new TGeoMaterial("steel", 0, 0, 0); TGeoMedium *steel = new TGeoMedium ("steel", 4, steel_mat); //########################################################**WORLD**###################################### TGeoVolume *world = mgr->MakeBox("world", void_med, 200, 200, 200); world->SetTransparency(100); //########################################################**GEOMETRY**################################### TGeoPgon *theBis = new TGeoPgon (0., 360., 6, 2); theBis->DefineSection (0, -50, 40, 50); theBis->DefineSection (1, 50, 40, 50); TGeoVolume *theBisV = new TGeoVolume("theBis", theBis, steel); theBisV->SetLineColor(kGray); //########################################################**GET_POINTS**################################# //#starting point double t0[3] = {0,0,0}; TPolyLine3D *pl = new TPolyLine3D(2); pl->SetLineColor(kRed); pl->SetNextPoint(t0[0], t0[1], t0[2]); // #direction double tDir[3] = {0, 1, 0}; //#distance double inside_y = theBis->DistFromInside(t0, tDir); double outside_y = theBis->DistFromOutside(t0, tDir); pl->SetNextPoint(t0[0] + outside_y*tDir[0], t0[1] + outside_y*tDir[1], t0[2] + outside_y*tDir[2]); std::cout << "inside_y >>>>>>> " << inside_y << " #Expected : 50.0#" << std::endl; std::cout << "outside_y >>>>>> " << outside_y << " #Expected : 40.0#" << std::endl; //########################################################**DISPLAY**#################################### //#save // theBis.SaveAs("shape.root") world->AddNode(theBisV,0); mgr->SetTopVolume(world); mgr->GetMasterVolume()->SetVisContainers(true); mgr->SetNsegments(5); mgr->SetTopVisible(true); mgr->SetVisLevel(15); mgr->CloseGeometry(); mgr->GetMasterVolume()->Draw(); gPad->GetView()->ShowAxis(); pl->Draw(); }