2828#include < unistd.h>
2929
3030namespace {
31+
3132std::string joinPaths (const std::string& a, const std::string& b) {
3233 if (b.substr (0 , 1 ) == " /" || a.empty ()) {
3334 return b;
@@ -50,13 +51,13 @@ std::string getWorkingDirectory() {
5051
5152void Acts::GeometryView3D::drawPolyhedron (IVisualization3D& helper,
5253 const Polyhedron& polyhedron,
53- const ViewConfig& ViewConfig ) {
54- if (ViewConfig .visible ) {
55- if (not ViewConfig .triangulate ) {
56- helper.faces (polyhedron.vertices , polyhedron.faces , ViewConfig .color );
54+ const ViewConfig& viewConfig ) {
55+ if (viewConfig .visible ) {
56+ if (not viewConfig .triangulate ) {
57+ helper.faces (polyhedron.vertices , polyhedron.faces , viewConfig .color );
5758 } else {
5859 helper.faces (polyhedron.vertices , polyhedron.triangularMesh ,
59- ViewConfig .color );
60+ viewConfig .color );
6061 }
6162 }
6263}
@@ -65,13 +66,13 @@ void Acts::GeometryView3D::drawSurface(IVisualization3D& helper,
6566 const Surface& surface,
6667 const GeometryContext& gctx,
6768 const Transform3& transform,
68- const ViewConfig& ViewConfig ) {
69+ const ViewConfig& viewConfig ) {
6970 Polyhedron surfaceHedron =
70- surface.polyhedronRepresentation (gctx, ViewConfig .nSegments );
71+ surface.polyhedronRepresentation (gctx, viewConfig .nSegments );
7172 if (not transform.isApprox (Transform3::Identity ())) {
7273 surfaceHedron.move (transform);
7374 }
74- drawPolyhedron (helper, surfaceHedron, ViewConfig );
75+ drawPolyhedron (helper, surfaceHedron, viewConfig );
7576}
7677
7778void Acts::GeometryView3D::drawSurfaceArray (
@@ -191,42 +192,23 @@ void Acts::GeometryView3D::drawPortal(IVisualization3D& helper,
191192
192193void Acts::GeometryView3D::drawDetectorVolume (
193194 IVisualization3D& helper, const Experimental::DetectorVolume& volume,
194- const GeometryContext& gctx, bool drawSurfaces, const Transform3& transform,
195+ const GeometryContext& gctx, const Transform3& transform,
195196 const ViewConfig& connected, const ViewConfig& unconnected,
196197 const ViewConfig& viewConfig) {
198+ // draw the surfaces of the mother volume
199+ for (auto surface : volume.surfaces ()) {
200+ drawSurface (helper, *surface, gctx, transform, viewConfig);
201+ }
202+
197203 // draw the envelope first
198- auto portals = volume.portals ();
199- for (auto portal : portals) {
204+ for (auto portal : volume.portals ()) {
200205 drawPortal (helper, *portal, gctx, transform, connected, unconnected);
201206 }
202207
203- // draw the surfaces of the mother volume
204- if (drawSurfaces) {
205- auto surfaces = volume.surfaces ();
206- for (auto surface : surfaces) {
207- drawSurface (helper, *surface, gctx, transform, viewConfig);
208- }
209- }
210- // recurse if there are subvolumes, otherwise draw the portals and the
211- // surfaces if tag is true
212- auto subvolumes = volume.volumes ();
213- for (auto subvolume : subvolumes) {
214- if (!subvolume->volumes ().empty ()) {
215- drawDetectorVolume (helper, *subvolume, gctx, drawSurfaces, transform,
216- connected, unconnected, viewConfig);
217- } else {
218- auto sub_portals = subvolume->portals ();
219- for (auto sub_portal : sub_portals) {
220- drawPortal (helper, *sub_portal, gctx, transform, connected,
221- unconnected);
222- }
223- if (drawSurfaces) {
224- auto sub_surfaces = subvolume->surfaces ();
225- for (auto sub_surface : sub_surfaces) {
226- drawSurface (helper, *sub_surface, gctx, transform, viewConfig);
227- }
228- }
229- }
208+ // recurse if there are subvolumes
209+ for (auto subvolume : volume.volumes ()) {
210+ drawDetectorVolume (helper, *subvolume, gctx, transform, connected,
211+ unconnected, viewConfig);
230212 }
231213}
232214
0 commit comments