|
|
|||
File indexing completed on 2025-11-04 09:21:33
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/Geometry/Extent.hpp" 0013 #include "Acts/Visualization/ViewConfig.hpp" 0014 0015 #include <cstddef> 0016 #include <vector> 0017 0018 namespace Acts { 0019 0020 class IVisualization3D; 0021 0022 /// @class Polyhedron 0023 /// 0024 /// Struct which contains a cartesian approximation for any surface type. 0025 /// It contains a list of cartesian vertices in the global frame, and 0026 /// additionally 0027 /// a list of lists of indices which indicate which vertices form a face. 0028 /// Each entry in @c faces is a face, which is in turn a list of vertices 0029 /// that need to be connected to form a face. 0030 /// This allows the @c objString method to produce a ready-to-go obj output. 0031 struct Polyhedron { 0032 /// Type alias for face definition as vertex indices 0033 using FaceType = std::vector<std::size_t>; 0034 0035 /// Default constructor 0036 Polyhedron() = default; 0037 0038 /// Default constructor from a vector of vertices and a vector of faces 0039 /// @param verticesIn The 3D global vertices that make up the object 0040 /// @param facesIn List of lists of indices for faces. 0041 /// @param triangularMeshIn List of lists of indices for a triangular mesh 0042 /// @param isExact A dedicated flag if this is exact or not 0043 /// 0044 /// @note This creates copies of the input vectors 0045 Polyhedron(const std::vector<Vector3>& verticesIn, 0046 const std::vector<FaceType>& facesIn, 0047 const std::vector<FaceType>& triangularMeshIn, bool isExact = true) 0048 : vertices(verticesIn), 0049 faces(facesIn), 0050 triangularMesh(triangularMeshIn), 0051 exact(isExact) {} 0052 0053 /// List of 3D vertices as vectors 0054 std::vector<Vector3> vertices; 0055 0056 /// List of faces connecting the vertices. 0057 /// each face is a list of vertices v 0058 /// corresponding to the vertex vector above 0059 std::vector<FaceType> faces; 0060 0061 /// List of faces connecting the vertices. 0062 /// each face is a list of vertices v 0063 /// - in this case restricted to a triangular representation 0064 std::vector<FaceType> triangularMesh; 0065 0066 /// Is this an exact representation (approximating curved spaces) 0067 bool exact = true; 0068 0069 /// Merge another Polyhedron into this one 0070 /// 0071 /// @param other is the source representation 0072 void merge(const Polyhedron& other); 0073 0074 /// Move the polyhedron with a Transfrom3D 0075 /// 0076 /// @param transform The additional transform applied 0077 void move(const Transform3& transform); 0078 0079 /// Maximum extent of the polyhedron in space 0080 /// 0081 /// @param transform An (optional) transform 0082 /// to apply to the vertices for estimation the extent 0083 /// with respect to a given coordinate frame 0084 /// 0085 /// @return ranges that describe the space taken by this surface 0086 Extent extent(const Transform3& transform = Transform3::Identity()) const; 0087 0088 /// Visualize the polyhedron using a visualization helper 0089 /// @param helper The visualization interface to use for rendering 0090 /// @param viewConfig Configuration options for visualization appearance 0091 void visualize(IVisualization3D& helper, 0092 const ViewConfig& viewConfig = {}) const; 0093 }; 0094 } // 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 |
|