File indexing completed on 2025-01-18 09:11:14
0001
0002
0003
0004
0005
0006
0007
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 <filesystem>
0017 #include <fstream>
0018 #include <string>
0019 #include <utility>
0020 #include <vector>
0021
0022 namespace Acts {
0023
0024 template <typename T = double>
0025
0026
0027 class PlyVisualization3D : public IVisualization3D {
0028 public:
0029 static_assert(std::is_same_v<T, double> || std::is_same_v<T, float>,
0030 "Use either double or float");
0031
0032
0033 using ValueType = T;
0034
0035
0036 using VertexType = Eigen::Matrix<ValueType, 3, 1>;
0037
0038
0039 void vertex(const Vector3& vtx, Color color = {120, 120, 120}) final;
0040
0041
0042 void face(const std::vector<Vector3>& vtxs,
0043 Color color = {120, 120, 120}) final;
0044
0045
0046 void faces(const std::vector<Vector3>& vtxs,
0047 const std::vector<FaceType>& faces,
0048 Color color = {120, 120, 120}) final;
0049
0050
0051 void line(const Vector3& a, const Vector3& b,
0052 Color color = {120, 120, 120}) final;
0053
0054
0055 void write(const std::filesystem::path& path) const final;
0056
0057
0058 void write(std::ostream& os) const final;
0059
0060
0061 void clear() final;
0062
0063 void object(const std::string& ) final {
0064
0065 }
0066
0067 private:
0068 std::vector<std::pair<VertexType, Color>> m_vertices;
0069 std::vector<FaceType> m_faces;
0070 std::vector<std::pair<std::pair<std::size_t, std::size_t>, Color>> m_edges;
0071 };
0072
0073 #ifndef DOXYGEN
0074 #include "detail/PlyVisualization3D.ipp"
0075 #endif
0076
0077 }