Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-24 08:05:09

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/GeometryContext.hpp"
0013 #include "Acts/Geometry/Volume.hpp"
0014 #include "Acts/Visualization/IVisualization3D.hpp"
0015 #include "Acts/Visualization/ViewConfig.hpp"
0016 
0017 #include <filesystem>
0018 #include <string>
0019 
0020 namespace Acts {
0021 
0022 class Layer;
0023 class Surface;
0024 class SurfaceArray;
0025 class TrackingVolume;
0026 struct Polyhedron;
0027 class IVisualization3D;
0028 
0029 /// Helper utilities for drawing geometry in 3D views.
0030 struct GeometryView3D {
0031   /// Helper method to draw Polyhedron objects
0032   ///
0033   /// @param [in,out] helper The visualization helper
0034   /// @param polyhedron The surface to be drawn
0035   /// @param viewConfig The drawing configuration
0036   static void drawPolyhedron(IVisualization3D& helper,
0037                              const Polyhedron& polyhedron,
0038                              const ViewConfig& viewConfig = s_viewVolume);
0039 
0040   /// Helper method to draw Surface objects
0041   ///
0042   /// @param [in,out] helper The visualization helper
0043   /// @param surface The surface to be drawn
0044   /// @param gctx The geometry context for which it is drawn
0045   /// @param transform An option additional transform
0046   /// @param viewConfig The drawing configuration
0047   static void drawSurface(IVisualization3D& helper, const Surface& surface,
0048                           const GeometryContext& gctx,
0049                           const Transform3& transform = Transform3::Identity(),
0050                           const ViewConfig& viewConfig = s_viewSensitive);
0051 
0052   /// Helper method to draw SurfaceArray objects
0053   ///
0054   /// @param [in,out] helper The visualization helper
0055   /// @param surfaceArray The surface to be drawn
0056   /// @param gctx The geometry context for which it is drawn
0057   /// @param transform An option additional transform
0058   /// @param sensitiveConfig The drawing configuration for sensitive surfaces
0059   /// @param passiveConfig The drawing configuration for passive surfaces
0060   /// @param gridConfig The drawing configuration for grid
0061   /// @param outputDir Directory to write to
0062   static void drawSurfaceArray(
0063       IVisualization3D& helper, const SurfaceArray& surfaceArray,
0064       const GeometryContext& gctx,
0065       const Transform3& transform = Transform3::Identity(),
0066       const ViewConfig& sensitiveConfig = s_viewSensitive,
0067       const ViewConfig& passiveConfig = s_viewPassive,
0068       const ViewConfig& gridConfig = s_viewGrid,
0069       const std::filesystem::path& outputDir = std::filesystem::path("."));
0070 
0071   /// Helper method to draw Volume objects
0072   ///
0073   /// @param [in,out] helper The visualization helper
0074   /// @param volume The volume to be drawn
0075   /// @param gctx The geometry context for which it is drawn
0076   /// @param transform An option additional transform
0077   /// @param viewConfig The drawing configuration for boundary surfaces
0078   static void drawVolume(IVisualization3D& helper, const Volume& volume,
0079                          const GeometryContext& gctx,
0080                          const Transform3& transform = Transform3::Identity(),
0081                          const ViewConfig& viewConfig = s_viewVolume);
0082 
0083   /// Helper method to draw Layer objects
0084   ///
0085   /// @param [in,out] helper The visualization helper
0086   /// @param layer The tracking layer to be drawn
0087   /// @param gctx The geometry context for which it is drawn
0088   /// @param layerConfig The drawing configuration for passive surfaces
0089   /// @param sensitiveConfig The drawing configuration for sensitive surfaces
0090   /// @param gridConfig The drawing configuration for grid display
0091   /// @param outputDir Directory to write to
0092   static void drawLayer(
0093       IVisualization3D& helper, const Layer& layer, const GeometryContext& gctx,
0094       const ViewConfig& layerConfig = s_viewPassive,
0095       const ViewConfig& sensitiveConfig = s_viewSensitive,
0096       const ViewConfig& gridConfig = s_viewGrid,
0097       const std::filesystem::path& outputDir = std::filesystem::path("."));
0098 
0099   /// Helper method to draw TrackingVolume objects
0100   ///
0101   /// @param [in,out] helper The visualization helper
0102   /// @param tVolume The tracking volume to be drawn
0103   /// @param gctx The geometry context for which it is drawn
0104   /// @param containerView The drawing configuration for a container volume
0105   /// @param volumeView The drawing configuration for the navigation level
0106   /// volume
0107   /// @param layerView The drawing configuration for passive surfaces
0108   /// @param sensitiveView The drawing configuration for sensitive surfaces
0109   /// @param gridView The drawing configuration for grid display
0110   /// @param writeIt The prescription to write it or not
0111   /// @param tag The (optional) additional output tag
0112   /// @param outputDir Directory to write to
0113   static void drawTrackingVolume(
0114       IVisualization3D& helper, const TrackingVolume& tVolume,
0115       const GeometryContext& gctx,
0116       const ViewConfig& containerView = s_viewVolume,
0117       const ViewConfig& volumeView = s_viewVolume,
0118       const ViewConfig& layerView = s_viewPassive,
0119       const ViewConfig& sensitiveView = s_viewSensitive,
0120       const ViewConfig& gridView = s_viewGrid, bool writeIt = true,
0121       const std::string& tag = "",
0122       const std::filesystem::path& outputDir = std::filesystem::path("."));
0123 
0124   /// Helper method to draw lines - base for all lines
0125   ///
0126   /// @param [in,out] helper The visualization helper
0127   /// @param start The start point
0128   /// @param end The end point
0129   /// @param arrows [ -1 | 0 | 1 | 2 ] = [ start | none | end | both ]
0130   /// @param arrowLength wrt halflength
0131   /// @param arrowWidth wrt thickness
0132   /// @param viewConfig The drawing configuration for this segment
0133   static void drawSegmentBase(IVisualization3D& helper, const Vector3& start,
0134                               const Vector3& end, int arrows = 0,
0135                               double arrowLength = 0., double arrowWidth = 0.,
0136                               const ViewConfig& viewConfig = s_viewLine);
0137 
0138   /// Convenience function : line
0139   ///
0140   /// @param [in,out] helper The visualization helper
0141   /// @param start The start point
0142   /// @param end The end point
0143   /// @param viewConfig The drawing configuration for this segment
0144   static void drawSegment(IVisualization3D& helper, const Vector3& start,
0145                           const Vector3& end,
0146                           const ViewConfig& viewConfig = s_viewLine);
0147 
0148   /// Convenience function : arrow pointing back
0149   ///
0150   /// @param [in,out] helper The visualization helper
0151   /// @param start The start point
0152   /// @param end The end point
0153   /// @param arrowLength wrt thickness
0154   /// @param arrowWidth wrt thickness
0155   /// @param viewConfig The drawing configuration for this segment
0156   static void drawArrowBackward(IVisualization3D& helper, const Vector3& start,
0157                                 const Vector3& end, double arrowLength,
0158                                 double arrowWidth,
0159                                 const ViewConfig& viewConfig = s_viewLine);
0160 
0161   /// Convenience function : arrow pointing forward
0162   ///
0163   /// @param [in,out] helper The visualization helper
0164   /// @param start The start point
0165   /// @param end The end point
0166   /// @param arrowLength wrt thickness
0167   /// @param arrowWidth wrt thickness
0168   /// @param viewConfig The drawing configuration for this segment
0169   static void drawArrowForward(IVisualization3D& helper, const Vector3& start,
0170                                const Vector3& end, double arrowLength,
0171                                double arrowWidth,
0172                                const ViewConfig& viewConfig = s_viewLine);
0173 
0174   /// Convenience function : arrow pointing both directions
0175   ///
0176   /// @param [in,out] helper The visualization helper
0177   /// @param start The start point
0178   /// @param end The end point
0179   /// @param arrowLength wrt thickness
0180   /// @param arrowWidth wrt thickness
0181   /// @param viewConfig The drawing configuration for this segment
0182   static void drawArrowsBoth(IVisualization3D& helper, const Vector3& start,
0183                              const Vector3& end, double arrowLength,
0184                              double arrowWidth,
0185                              const ViewConfig& viewConfig = s_viewLine);
0186 };
0187 
0188 }  // namespace Acts