Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-05 08:11:22

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