Skip to content

Commit

Permalink
fix: Fixing polyhedron representation for disc surfaces (#2289)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
noemina authored Jul 12, 2023
1 parent c499dfe commit 9ae9e8b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Core/src/Surfaces/DiscSurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand Down

0 comments on commit 9ae9e8b

Please sign in to comment.