Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:01:32

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