File indexing completed on 2026-04-05 07:45:30
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Acts/Surfaces/StrawSurface.hpp"
0010
0011 #include "Acts/Geometry/GeometryObject.hpp"
0012 #include "Acts/Geometry/Polyhedron.hpp"
0013 #include "Acts/Surfaces/LineBounds.hpp"
0014 #include "Acts/Surfaces/detail/FacesHelper.hpp"
0015 #include "Acts/Surfaces/detail/VerticesHelper.hpp"
0016
0017 #include <numbers>
0018 #include <utility>
0019 #include <vector>
0020
0021 namespace Acts {
0022
0023 Polyhedron StrawSurface::polyhedronRepresentation(
0024 const GeometryContext& gctx, unsigned int quarterSegments) const {
0025
0026 std::vector<Vector3> vertices;
0027 std::vector<Polyhedron::FaceType> faces;
0028 std::vector<Polyhedron::FaceType> triangularMesh;
0029
0030 const Transform3& ctransform = localToGlobalTransform(gctx);
0031
0032 if (quarterSegments > 0u) {
0033 double r = m_bounds->get(LineBounds::eR);
0034
0035 std::vector<int> sides = {-1, 1};
0036 for (auto& side : sides) {
0037
0038 auto svertices = detail::VerticesHelper::segmentVertices(
0039 {r, r}, -std::numbers::pi, std::numbers::pi, {}, quarterSegments,
0040 Vector3(0., 0., side * m_bounds->get(LineBounds::eHalfLengthZ)),
0041 ctransform);
0042 vertices.insert(vertices.end(), svertices.begin(), svertices.end());
0043 }
0044 auto facesMesh = detail::FacesHelper::cylindricalFaceMesh(vertices);
0045 faces = facesMesh.first;
0046 triangularMesh = facesMesh.second;
0047 }
0048
0049 std::size_t bvertices = vertices.size();
0050 Vector3 left(0, 0, -m_bounds->get(LineBounds::eHalfLengthZ));
0051 Vector3 right(0, 0, m_bounds->get(LineBounds::eHalfLengthZ));
0052
0053 vertices.push_back(ctransform * left);
0054 vertices.push_back(ctransform * right);
0055 faces.push_back({bvertices, bvertices + 1});
0056 vertices.push_back(ctransform * Vector3(0., 0., 0.));
0057 triangularMesh.push_back({bvertices, bvertices + 2, bvertices + 1});
0058
0059 return Polyhedron(vertices, faces, triangularMesh, false);
0060 }
0061
0062 }