From 9ae9e8bf09e5a4732236a7263dee3c380845dadc Mon Sep 17 00:00:00 2001 From: Noemi Calace <58694235+noemina@users.noreply.github.com> Date: Wed, 12 Jul 2023 10:57:17 +0200 Subject: [PATCH] fix: Fixing polyhedron representation for disc surfaces (#2289) This PR is fixing the polyhedron representation of disc surfaces. I have removed the centre from the list of vertices representing the surface, which was causing the surfaces being wrongly displayed. --- Core/src/Surfaces/DiscSurface.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Core/src/Surfaces/DiscSurface.cpp b/Core/src/Surfaces/DiscSurface.cpp index 30e1788f7fb..efffdff8232 100644 --- a/Core/src/Surfaces/DiscSurface.cpp +++ b/Core/src/Surfaces/DiscSurface.cpp @@ -157,6 +157,7 @@ Acts::Polyhedron Acts::DiscSurface::polyhedronRepresentation( bool toCenter = m_bounds->rMin() < s_onSurfaceTolerance; // If you have bounds you can create a polyhedron representation bool exactPolyhedron = (m_bounds->type() == SurfaceBounds::eDiscTrapezoid); + bool addCentreFromConvexFace = (m_bounds->type() != SurfaceBounds::eAnnulus); if (m_bounds) { auto vertices2D = m_bounds->vertices(lseg); vertices.reserve(vertices2D.size() + 1); @@ -167,11 +168,12 @@ Acts::Polyhedron Acts::DiscSurface::polyhedronRepresentation( } // These are convex shapes, use the helper method // For rings there's a sweet spot when this stops working - if (m_bounds->type() == SurfaceBounds::eDiscTrapezoid or toCenter or - not fullDisc) { + if (exactPolyhedron or toCenter or not fullDisc) { // Transform them into the vertex frame wCenter *= 1. / vertices.size(); - vertices.push_back(wCenter); + if (addCentreFromConvexFace) { + vertices.push_back(wCenter); + } auto facesMesh = detail::FacesHelper::convexFaceMesh(vertices, true); faces = facesMesh.first; triangularMesh = facesMesh.second;