Skip to content

Commit

Permalink
feat: Added a function that draws the detector volume with inner surf…
Browse files Browse the repository at this point in the history
…aces (#1946)

Added the `drawDetectorVolumeWithSurfaces` function that draws the detector volume with the sub-volumes and their surfaces . Any comments and recommendations are more than welcome. 
@andiwand @Matthewharri @asalzburger
  • Loading branch information
dimitra97 committed Mar 16, 2023
1 parent 95e3d9a commit 6b86cef
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
7 changes: 5 additions & 2 deletions Core/include/Acts/Visualization/GeometryView3D.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,19 @@ struct GeometryView3D {
/// @param [in,out] helper The visualization helper
/// @param volume The DetectorVolume to be drawn
/// @param gctx The geometry context for which it is drawn
/// @param drawSurfaces switches on/off the drawing of the volumes' surfaces
/// @param transform An option additional transform
/// @param connected The config for connected portals
/// @param unconnected The config for unconnected portals
/// @param viewConfig The drawing configuration
static void drawDetectorVolume(
IVisualization3D& helper,
const Acts::Experimental::DetectorVolume& volume,
const GeometryContext& gctx,
const GeometryContext& gctx, bool drawSurfaces,
const Transform3& transform = Transform3::Identity(),
const ViewConfig& connected = ViewConfig({0, 255, 0}),
const ViewConfig& unconnected = ViewConfig({255, 0, 0}));
const ViewConfig& unconnected = ViewConfig({255, 0, 0}),
const ViewConfig& viewConfig = s_viewSensitive);

/// Helper method to draw AbstractVolume objects
///
Expand Down
26 changes: 21 additions & 5 deletions Core/src/Visualization/GeometryView3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,25 +191,41 @@ void Acts::GeometryView3D::drawPortal(IVisualization3D& helper,

void Acts::GeometryView3D::drawDetectorVolume(
IVisualization3D& helper, const Experimental::DetectorVolume& volume,
const GeometryContext& gctx, const Transform3& transform,
const ViewConfig& connected, const ViewConfig& unconnected) {
const GeometryContext& gctx, bool drawSurfaces, const Transform3& transform,
const ViewConfig& connected, const ViewConfig& unconnected,
const ViewConfig& viewConfig) {
// draw the envelope first
auto portals = volume.portals();
for (auto portal : portals) {
drawPortal(helper, *portal, gctx, transform, connected, unconnected);
}
// recurse if there are subvolumes, otherwise draw the portals

// draw the surfaces of the mother volume
if (drawSurfaces) {
auto surfaces = volume.surfaces();
for (auto surface : surfaces) {
drawSurface(helper, *surface, gctx, transform, viewConfig);
}
}
// recurse if there are subvolumes, otherwise draw the portals and the
// surfaces if tag is true
auto subvolumes = volume.volumes();
for (auto subvolume : subvolumes) {
if (!subvolume->volumes().empty()) {
drawDetectorVolume(helper, *subvolume, gctx, transform, connected,
unconnected);
drawDetectorVolume(helper, *subvolume, gctx, drawSurfaces, transform,
connected, unconnected, viewConfig);
} else {
auto sub_portals = subvolume->portals();
for (auto sub_portal : sub_portals) {
drawPortal(helper, *sub_portal, gctx, transform, connected,
unconnected);
}
if (drawSurfaces) {
auto sub_surfaces = subvolume->surfaces();
for (auto sub_surface : sub_surfaces) {
drawSurface(helper, *sub_surface, gctx, transform, viewConfig);
}
}
}
}
}
Expand Down

0 comments on commit 6b86cef

Please sign in to comment.