|
||||
File indexing completed on 2025-01-18 09:11:14
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/ViewConfig.hpp" 0013 0014 #include <cstddef> 0015 #include <filesystem> 0016 #include <vector> 0017 0018 namespace Acts { 0019 0020 /// Partially abstract base class which provides an interface to visualization 0021 /// helper classes. It provides a number of methods that all the helpers need to 0022 /// conform to. 0023 class IVisualization3D { 0024 public: 0025 using FaceType = std::vector<std::size_t>; 0026 0027 static constexpr Color s_defaultColor = {120, 120, 120}; 0028 0029 /// Draw a vertex at a given location and a color. 0030 /// @param vtx The vertex position 0031 /// @param color The color 0032 /// 0033 virtual void vertex(const Vector3& vtx, Color color = s_defaultColor) = 0; 0034 0035 /// Draw a face that connects a list of vertices. 0036 /// @note Depending on the helper implementation, out of plane vertices might 0037 /// be handled differently. 0038 /// @param vtxs The vertices that make up the face 0039 /// @param color The color of the face 0040 /// 0041 virtual void face(const std::vector<Vector3>& vtxs, 0042 Color color = s_defaultColor) = 0; 0043 0044 /// Draw a faces that connects a list of vertices - expert only 0045 /// 0046 /// @note Depending on the helper implementation, out of plane vertices might 0047 /// be handled differently. 0048 /// @param vtxs The vertices that make up the faceS 0049 /// @param faces The face presections (i.e. connecting vertices) 0050 /// @param color The color of the face 0051 /// 0052 virtual void faces(const std::vector<Vector3>& vtxs, 0053 const std::vector<FaceType>& faces, 0054 Color color = s_defaultColor) = 0; 0055 0056 /// Draw a line from a vertex to another 0057 /// @param a The start vertex 0058 /// @param b The end vertex 0059 /// @param color The color of the line 0060 /// 0061 virtual void line(const Vector3& a, const Vector3& b, 0062 Color color = s_defaultColor) = 0; 0063 0064 /// Write the content of the helper to an outstream. 0065 /// @param os The output stream for file 0066 virtual void write(std::ostream& os) const = 0; 0067 0068 /// Write the content of the helper to an outstream. 0069 /// @param path is the file system path for writing the file 0070 virtual void write(const std::filesystem::path& path) const = 0; 0071 0072 /// Remove all contents of this helper 0073 /// 0074 virtual void clear() = 0; 0075 0076 virtual ~IVisualization3D() = default; 0077 0078 /// Start a new object context 0079 /// @param name The name of the object 0080 virtual void object(const std::string& name) = 0; 0081 }; 0082 0083 /// Overload of the << operator to facilitate writing to streams. 0084 /// @param os The output stream 0085 /// @param hlp The helper instance 0086 inline std::ostream& operator<<(std::ostream& os, const IVisualization3D& hlp) { 0087 hlp.write(os); 0088 return os; 0089 } 0090 } // namespace Acts
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |