Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PlyVisualization3D.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PlyVisualization3D.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2019 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 
14 
15 #include <array>
16 #include <fstream>
17 #include <string>
18 #include <utility>
19 #include <vector>
20 
21 namespace Acts {
22 
23 template <typename T = double>
24 
27  public:
28  static_assert(std::is_same_v<T, double> || std::is_same_v<T, float>,
29  "Use either double or float");
30 
32  using ValueType = T;
33 
35  using VertexType = Eigen::Matrix<ValueType, 3, 1>;
36 
38  void vertex(const Vector3& vtx, ColorRGB color = {120, 120, 120}) final;
39 
41  void face(const std::vector<Vector3>& vtxs,
42  ColorRGB color = {120, 120, 120}) final;
43 
45  void faces(const std::vector<Vector3>& vtxs,
46  const std::vector<FaceType>& faces,
47  ColorRGB color = {120, 120, 120}) final;
48 
50  void line(const Vector3& a, const Vector3& b,
51  ColorRGB color = {120, 120, 120}) final;
52 
54  void write(const std::string& path) const final;
55 
57  void write(std::ostream& os) const final;
58 
60  void clear() final;
61 
62  private:
63  std::vector<std::pair<VertexType, ColorRGB>> m_vertices;
64  std::vector<FaceType> m_faces;
65  std::vector<std::pair<std::pair<size_t, size_t>, ColorRGB>> m_edges;
66 };
67 
68 #ifndef DOXYGEN
70 #endif
71 
72 } // namespace Acts