25#include "TGeoTessellated.h"
31using ROOT::Geom::Vertex_t;
35 std::vector<std::vector<VGM::ThreeVector> > facets)
36 :
VGM::ISolid(),
VGM::ITessellatedSolid(),
BaseVGM::VTessellatedSolid(),
43 fTessellated =
new TGeoTessellated();
44 fTessellated->SetName(name.data());
48 for (Int_t i = 0; i < Int_t(facets.size()); i++) {
50 std::vector<VGM::ThreeVector> facet = facets[i];
53 if (facet.size() != 3 && facet.size() != 4) {
54 std::cerr <<
"+++ Error +++" << std::endl;
55 std::cerr <<
" Number of vertices in a facet = " << facet.size()
56 <<
" has to be == 3 or 4" << std::endl;
60 if (facet.size() == 3 ) {
66 fTessellated->AddFacet(
84 fTessellated->AddFacet(
99 fTessellated->CloseShape();
106 :
VGM::ISolid(),
VGM::ITessellatedSolid(),
BaseVGM::VTessellatedSolid(),
107 fTessellated(tessellated)
116 :
VGM::ISolid(),
VGM::ITessellatedSolid(),
BaseVGM::VTessellatedSolid(), fTessellated(0)
124 VGM::ITessellatedSolid(rhs),
125 BaseVGM::VTessellatedSolid(rhs),
138void RootGM::TessellatedSolid::CheckFacetIndex(
int ifacet)
const
140 if (ifacet < 0 || ifacet > NofFacets()) {
141 std::cerr <<
"+++ Error +++" << std::endl;
142 std::cerr <<
" Wrong facet index: " << ifacet << std::endl;
148void RootGM::TessellatedSolid::CheckVertexIndex(
int ifacet,
int index)
const
150 CheckFacetIndex(ifacet);
152 if (index < 0 || index > NofVertices(ifacet)) {
153 std::cerr <<
"+++ Error +++" << std::endl;
154 std::cerr <<
" Wrong vertex index: " << index <<
" in " << ifacet
155 <<
" th facet." << std::endl;
169 CheckFacetIndex(ifacet);
171 const TGeoFacet& facet = fTessellated->GetFacet(ifacet);
173 return facet.GetNvert();
179 CheckVertexIndex(ifacet, index);
181#if ROOT_VERSION_CODE > ROOT_VERSION(6, 30, 4)
182 const auto& rvertex = fTessellated->GetVertex((fTessellated->GetFacet(ifacet))[index]);
184 const auto& rvertex = fTessellated->GetFacet(ifacet).GetVertex(index);
void AddSolid(VGM::ISolid *, TGeoShape *)
static SolidMap * Instance()
VGM implementation for Root tessellated solid.
virtual ~TessellatedSolid()
virtual VGM::ThreeVector Vertex(int ifacet, int index) const
Return the index-th vertex in the ifacet-th facet.
virtual std::string Name() const
Return the name of this solid.
virtual int NofVertices(int ifacet) const
Return the number of vertices in the the ifacet-th facet.
virtual int NofFacets() const
Return the number of facets.
static double Length()
Return Root length unit in VGM units.
std::vector< double > ThreeVector