/// \file /// \ingroup tutorial_geom /// Macro allowing to vizualize tessellations from Wavefront's .obj format. /// /// \image html geom_visualizeWavefrontObj.png width=500px /// \macro_code #include #include #include #include //______________________________________________________________________________ void teddy_family() { // Input a file in .obj format (https://en.wikipedia.org/wiki/Wavefront_.obj_file) // The file should have a single object inside, only vertex and faces information is used TString sfile = gROOT->GetTutorialsDir(); sfile += "/geom/teddy.obj"; gROOT->GetListOfCanvases()->Delete(); new TGeoManager("multi_teddy", "Imported from .obj file"); TGeoMedium *med = new TGeoMedium("MED", 1, new TGeoMaterial()); TGeoVolume *top = gGeoManager->MakeBox("TOP", med, 50, 50, 50); gGeoManager->SetTopVolume(top); auto teddy1 = TGeoTessellated::ImportFromObjFormat(sfile.Data()); teddy1->ResizeCenter(8.); auto teddy2 = TGeoTessellated::ImportFromObjFormat(sfile.Data()); teddy2->ResizeCenter(5.); auto teddy3 = TGeoTessellated::ImportFromObjFormat(sfile.Data()); teddy3->ResizeCenter(10.); auto vol1 = new TGeoVolume("teddy1", teddy1, med); vol1->SetLineColor(kOrange - 8); auto vol2 = new TGeoVolume("teddy2", teddy2, med); vol2->SetLineColor(kOrange - 7); auto vol3 = new TGeoVolume("teddy3", teddy3, med); vol3->SetLineColor(kOrange + 3); auto teddy_family = new TGeoVolumeAssembly("teddy_family"); teddy_family->AddNode(vol1, 1); teddy_family->AddNode(vol2, 1, new TGeoTranslation(10, -3, 5)); teddy_family->AddNode(vol3, 1, new TGeoTranslation(20, 2, 0)); top->AddNode(teddy_family, 1); gGeoManager->CloseGeometry(); if (!gROOT->IsBatch()) top->Draw("ogl"); }