ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ObjVisualization.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ObjVisualization.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 
13 
14 #include <array>
15 #include <fstream>
16 #include <map>
17 #include <sstream>
18 #include <string>
19 #include <vector>
20 
21 namespace Acts {
22 
26 template <typename T = double>
28  public:
29  static_assert(std::is_same_v<T, double> || std::is_same_v<T, float>,
30  "Use either double or float");
31 
33  using ValueType = T;
34 
37 
39  using LineType = std::pair<size_t, size_t>;
40 
42  void vertex(const Vector3D& vtx,
43  IVisualization::ColorType color = {0, 0, 0}) final;
44 
46  void line(const Vector3D& a, const Vector3D& b,
47  IVisualization::ColorType color = {0, 0, 0}) final;
48 
50  void face(const std::vector<Vector3D>& vtxs,
51  IVisualization::ColorType color = {0, 0, 0}) final;
52 
54  void faces(const std::vector<Vector3D>& vtxs,
55  const std::vector<FaceType>& faces,
56  ColorType color = {0, 0, 0}) final;
57 
59  void write(const std::string& path) const final;
60 
62  void write(std::ostream& os) const final;
63 
67  void write(std::ostream& os, std::ostream& mos) const;
68 
70  void clear() final;
71 
72  private:
73  std::vector<VertexType> m_vertices;
74  std::vector<FaceType> m_faces;
75  std::vector<LineType> m_lines;
80 };
81 
82 #include "detail/ObjVisualization.ipp"
83 
84 } // namespace Acts