Ejemplo n.º 1
0
void TessellatedSolid::SetMesh(TriangleMesh &mesh)
{
    G4TessellatedSolid *ts = this->m_Solid;
    for (int i=0; i<mesh.Triangles().size(); ++i) {
        const Vector3i &trg = mesh.Triangles().at(i);
        G4TriangularFacet *facet = new G4TriangularFacet(
                    DetectorsSolidPimpl::getG4Vector3f(mesh.Points().at(trg(0))),
                    DetectorsSolidPimpl::getG4Vector3f(mesh.Points().at(trg(1))),
                    DetectorsSolidPimpl::getG4Vector3f(mesh.Points().at(trg(2))),
                    ABSOLUTE);
        ts->AddFacet((G4VFacet *)facet);
    }
    this->m_Logical->SetSolid(ts);
}