Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:10:52

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Geometry/Extent.hpp"
0013 #include "Acts/Visualization/ViewConfig.hpp"
0014 
0015 #include <cstddef>
0016 #include <vector>
0017 
0018 namespace Acts {
0019 
0020 class IVisualization3D;
0021 
0022 /// @class Polyhedron
0023 ///
0024 /// Struct which contains a cartesian approximation for any surface type.
0025 /// It contains a list of cartesian vertices in the global frame, and
0026 /// additionally
0027 /// a list of lists of indices which indicate which vertices form a face.
0028 /// Each entry in @c faces is a face, which is in turn a list of vertices
0029 /// that need to be connected to form a face.
0030 /// This allows the @c objString method to produce a ready-to-go obj output.
0031 struct Polyhedron {
0032   using FaceType = std::vector<std::size_t>;
0033 
0034   /// Default constructor
0035   Polyhedron() = default;
0036 
0037   /// Default constructor from a vector of vertices and a vector of faces
0038   /// @param verticesIn The 3D global vertices that make up the object
0039   /// @param facesIn List of lists of indices for faces.
0040   /// @param triangularMeshIn List of lists of indices for a triangular mesh
0041   /// @param isExact A dedicated flag if this is exact or not
0042   ///
0043   /// @note This creates copies of the input vectors
0044   Polyhedron(const std::vector<Vector3>& verticesIn,
0045              const std::vector<FaceType>& facesIn,
0046              const std::vector<FaceType>& triangularMeshIn, bool isExact = true)
0047       : vertices(verticesIn),
0048         faces(facesIn),
0049         triangularMesh(triangularMeshIn),
0050         exact(isExact) {}
0051 
0052   /// List of 3D vertices as vectors
0053   std::vector<Vector3> vertices;
0054 
0055   /// List of faces connecting the vertices.
0056   /// each face is a list of vertices v
0057   /// corresponding to the vertex vector above
0058   std::vector<FaceType> faces;
0059 
0060   /// List of faces connecting the vertices.
0061   /// each face is a list of vertices v
0062   /// - in this case restricted to a triangular representation
0063   std::vector<FaceType> triangularMesh;
0064 
0065   /// Is this an exact representation (approximating curved spaces)
0066   bool exact = true;
0067 
0068   /// Merge another Polyhedron into this one
0069   ///
0070   /// @param other is the source representation
0071   void merge(const Polyhedron& other);
0072 
0073   /// Move the polyhedron with a Transfrom3D
0074   ///
0075   /// @param transform The additional transform applied
0076   void move(const Transform3& transform);
0077 
0078   /// Maximum extent of the polyhedron in space
0079   ///
0080   /// @param transform An (optional) transform
0081   /// to apply to the vertices for estimation the extent
0082   /// with respect to a given coordinate frame
0083   ///
0084   /// @return ranges that describe the space taken by this surface
0085   Extent extent(const Transform3& transform = Transform3::Identity()) const;
0086 
0087   void visualize(IVisualization3D& helper,
0088                  const ViewConfig& viewConfig = {}) const;
0089 };
0090 }  // namespace Acts