ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Polyhedron.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Polyhedron.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2018-2020 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #pragma once
10 
11 #include "Acts/Geometry/Extent.hpp"
15 
16 #include <array>
17 #include <limits>
18 #include <vector>
19 
20 namespace Acts {
21 
31 struct Polyhedron {
32  using FaceType = std::vector<size_t>;
33  using ColorType = std::array<int, 3>;
34 
36  Polyhedron() = default;
37 
44  Polyhedron(const std::vector<Vector3D>& verticesIn,
45  const std::vector<FaceType>& facesIn,
46  const std::vector<FaceType>& triangularMeshIn,
47  bool radialCheck = false)
48  : vertices(verticesIn),
49  faces(facesIn),
50  triangularMesh(triangularMeshIn) {}
51 
53  std::vector<Vector3D> vertices;
54 
58  std::vector<FaceType> faces;
59 
63  std::vector<FaceType> triangularMesh;
64 
68  void merge(const Polyhedron& other);
69 
73  void move(const Transform3D& transform);
74 
82  template <typename helper_t>
83  void draw(helper_t& helper, bool triangulate = false,
84  const ColorType& color = {120, 120, 120}) const {
85  // vertices and faces are
86  if (not triangulate) {
87  helper.faces(vertices, faces, color);
88  } else {
89  helper.faces(vertices, triangularMesh, color);
90  }
91  }
92 
100  Extent extent(const Transform3D& transform = Transform3D::Identity()) const;
101 };
102 } // namespace Acts