Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-19 09:23:43

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2019 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/Visualization/IVisualization3D.hpp"
0013 #include "Acts/Visualization/ViewConfig.hpp"
0014 
0015 #include <array>
0016 #include <fstream>
0017 #include <string>
0018 #include <utility>
0019 #include <vector>
0020 
0021 namespace Acts {
0022 
0023 template <typename T = double>
0024 
0025 /// @brief Helper to write out PlyVisualization3D visualization format
0026 class PlyVisualization3D : public IVisualization3D {
0027  public:
0028   static_assert(std::is_same_v<T, double> || std::is_same_v<T, float>,
0029                 "Use either double or float");
0030 
0031   /// Stored value type, should be double or float
0032   using ValueType = T;
0033 
0034   /// Type of a vertex based on the value type
0035   using VertexType = Eigen::Matrix<ValueType, 3, 1>;
0036 
0037   /// @copydoc Acts::IVisualization3D::vertex()
0038   void vertex(const Vector3& vtx, ColorRGB color = {120, 120, 120}) final;
0039 
0040   /// @copydoc Acts::IVisualization3D::face()
0041   void face(const std::vector<Vector3>& vtxs,
0042             ColorRGB color = {120, 120, 120}) final;
0043 
0044   /// @copydoc Acts::IVisualization3D::faces()
0045   void faces(const std::vector<Vector3>& vtxs,
0046              const std::vector<FaceType>& faces,
0047              ColorRGB color = {120, 120, 120}) final;
0048 
0049   /// @copydoc Acts::IVisualization3D::line()
0050   void line(const Vector3& a, const Vector3& b,
0051             ColorRGB color = {120, 120, 120}) final;
0052 
0053   /// @copydoc Acts::IVisualization3D::write(const std::string&) const
0054   void write(const std::string& path) const final;
0055 
0056   /// @copydoc Acts::IVisualization3D::write(std::ostream&) const
0057   void write(std::ostream& os) const final;
0058 
0059   /// @copydoc Acts::IVisualization3D::clear()
0060   void clear() final;
0061 
0062  private:
0063   std::vector<std::pair<VertexType, ColorRGB>> m_vertices;
0064   std::vector<FaceType> m_faces;
0065   std::vector<std::pair<std::pair<std::size_t, std::size_t>, ColorRGB>> m_edges;
0066 };
0067 
0068 #ifndef DOXYGEN
0069 #include "detail/PlyVisualization3D.ipp"
0070 #endif
0071 
0072 }  // namespace Acts