Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ViewParameters.cc File Reference
#include "G4ViewParameters.hh"
#include "G4VisManager.hh"
#include "G4VPhysicalVolume.hh"
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
#include "G4Polyhedron.hh"
#include <sstream>
#include <cmath>

Go to the source code of this file.

Macros

#define G4warn   G4cout
#define INTERPOLATE(param)
#define INTERPOLATELOG(param)
#define INTERPOLATEUNITVECTOR(vector)
#define INTERPOLATEVECTOR(vector)
#define INTERPOLATEPOINT(point)
#define INTERPOLATECOLOUR(colour)
#define CONTINUITY(quantity)
#define INTERPOLATEPLANE(plane)

Functions

std::ostream & operator<< (std::ostream &os, G4ViewParameters::DrawingStyle style)
std::ostream & operator<< (std::ostream &os, G4ViewParameters::SMROption option)
std::ostream & operator<< (std::ostream &os, const G4ViewParameters &v)

Macro Definition Documentation

◆ CONTINUITY

#define CONTINUITY ( quantity)
Value:
continuous = false; \
/* This follows the logic of the INTERPOLATE macro above; see comments therein */ \
if (i == 0) { \
if (v[1].quantity == v[0].quantity) { \
if (n == 1) continuous = true; \
else if (v[2].quantity == v[0].quantity) \
continuous = true; \
} \
} else if (i >= n - 1) { \
if (v[i+1].quantity == v[i].quantity) { \
if (n == 1) continuous = true; \
else if (v[i+1].quantity == v[i-1].quantity) \
continuous = true; \
} \
} else { \
if (v[i-1].quantity == v[i].quantity && \
v[i+1].quantity == v[i].quantity && \
v[i+2].quantity == v[i].quantity) \
continuous = true; \
}

Referenced by G4ViewParameters::CatmullRomCubicSplineInterpolation().

◆ G4warn

#define G4warn   G4cout

Definition at line 43 of file G4ViewParameters.cc.

◆ INTERPOLATE

#define INTERPOLATE ( param)
Value:
/* This works out the interpolated param in i'th interval */ \
/* Assumes n >= 1 */ \
if (i == 0) { \
/* First interval */ \
mi = v[1].param - v[0].param; \
/* If there is only one interval, make start and end slopes equal */ \
/* (This results in a linear interpolation) */ \
if (n == 1) mi1 = mi; \
/* else the end slope of the interval takes account of the next waypoint along */ \
else mi1 = 0.5 * (v[2].param - v[0].param); \
} else if (i >= n - 1) { \
/* Similarly for last interval */ \
mi1 = v[i+1].param - v[i].param; \
/* If there is only one interval, make start and end slopes equal */ \
if (n == 1) mi = mi1; \
/* else the start slope of the interval takes account of the previous waypoint */ \
else mi = 0.5 * (v[i+1].param - v[i-1].param); \
} else { \
/* Full Catmull-Rom slopes use previous AND next waypoints */ \
mi = 0.5 * (v[i+1].param - v[i-1].param); \
mi1 = 0.5 * (v[i+2].param - v[i ].param); \
} \
real = h00 * v[i].param + h10 * mi + h01 * v[i+1].param + h11 * mi1;

Referenced by G4ViewParameters::CatmullRomCubicSplineInterpolation().

◆ INTERPOLATECOLOUR

#define INTERPOLATECOLOUR ( colour)
Value:
INTERPOLATE(colour.GetRed()); red = real; \
INTERPOLATE(colour.GetGreen()); green = real; \
INTERPOLATE(colour.GetBlue()); blue = real; \
INTERPOLATE(colour.GetAlpha()); alpha = real;
#define INTERPOLATE(param)

Referenced by G4ViewParameters::CatmullRomCubicSplineInterpolation().

◆ INTERPOLATELOG

#define INTERPOLATELOG ( param)
Value:
if (i == 0) { \
mi = std::log(v[1].param) - std::log(v[0].param); \
if (n == 1) mi1 = mi; \
else mi1 = 0.5 * (std::log(v[2].param) - std::log(v[0].param)); \
} else if (i >= n - 1) { \
mi1 = std::log(v[i+1].param) - std::log(v[i].param); \
if (n == 1) mi = mi1; \
else mi = 0.5 * (std::log(v[i+1].param) - std::log(v[i-1].param)); \
} else { \
mi = 0.5 * (std::log(v[i+1].param) - std::log(v[i-1].param)); \
mi1 = 0.5 * (std::log(v[i+2].param) - std::log(v[i ].param)); \
} \
real = std::exp(h00 * std::log(v[i].param) + h10 * mi + h01 * std::log(v[i+1].param) + h11 * mi1);

Referenced by G4ViewParameters::CatmullRomCubicSplineInterpolation().

◆ INTERPOLATEPLANE

#define INTERPOLATEPLANE ( plane)
Value:
INTERPOLATE(plane.a()); a = real; \
INTERPOLATE(plane.b()); b = real; \
INTERPOLATE(plane.c()); c = real; \
INTERPOLATE(plane.d()); d = real;

Referenced by G4ViewParameters::CatmullRomCubicSplineInterpolation().

◆ INTERPOLATEPOINT

#define INTERPOLATEPOINT ( point)
Value:
INTERPOLATE(point.x()); x = real; \
INTERPOLATE(point.y()); y = real; \
INTERPOLATE(point.z()); z = real;

Referenced by G4ViewParameters::CatmullRomCubicSplineInterpolation().

◆ INTERPOLATEUNITVECTOR

#define INTERPOLATEUNITVECTOR ( vector)
Value:
INTERPOLATE(vector.x()); x = real; \
INTERPOLATE(vector.y()); y = real; \
INTERPOLATE(vector.z()); z = real;

Referenced by G4ViewParameters::CatmullRomCubicSplineInterpolation().

◆ INTERPOLATEVECTOR

#define INTERPOLATEVECTOR ( vector)
Value:
INTERPOLATE(vector.x()); x = real; \
INTERPOLATE(vector.y()); y = real; \
INTERPOLATE(vector.z()); z = real;

Referenced by G4ViewParameters::CatmullRomCubicSplineInterpolation().

Function Documentation

◆ operator<<() [1/3]

std::ostream & operator<< ( std::ostream & os,
const G4ViewParameters & v )

Definition at line 920 of file G4ViewParameters.cc.

920 {
921 os << "View parameters and options:";
922
923 os << "\n Drawing style: " << v.fDrawingStyle;
924
925 os << "\n Number of cloud points: " << v.fNumberOfCloudPoints;
926
927 os << "\n Auxiliary edges: ";
928 if (!v.fAuxEdgeVisible) os << "in";
929 os << "visible";
930
931 os << "\n Culling: ";
932 if (v.fCulling) os << "on";
933 else os << "off";
934
935 os << "\n Culling invisible objects: ";
936 if (v.fCullInvisible) os << "on";
937 else os << "off";
938
939 os << "\n Density culling: ";
940 if (v.fDensityCulling) {
941 os << "on - invisible if density less than "
942 << v.fVisibleDensity / (1. * g / cm3) << " g cm^-3";
943 }
944 else os << "off";
945
946 os << "\n Culling daughters covered by opaque mothers: ";
947 if (v.fCullCovered) os << "on";
948 else os << "off";
949
950 os << "\n Colour by density: ";
951 if (v.fCBDAlgorithmNumber <= 0) {
952 os << "inactive";
953 } else {
954 os << "Algorithm " << v.fCBDAlgorithmNumber << ", Parameters:";
955 for (auto p: v.fCBDParameters) {
956 os << ' ' << G4BestUnit(p,"Volumic Mass");
957 }
958 }
959
960 os << "\n Section flag: ";
961 if (v.fSection) os << "true, section/cut plane: " << v.fSectionPlane;
962 else os << "false";
963
964 if (v.IsCutaway()) {
965 os << "\n Cutaway planes: ";
966 for (const auto& fCutawayPlane : v.fCutawayPlanes) {
967 os << ' ' << fCutawayPlane;
968 }
969 }
970 else {
971 os << "\n No cutaway planes";
972 }
973
974 os << "\n Explode factor: " << v.fExplodeFactor
975 << " about centre: " << v.fExplodeCentre;
976
977 os << "\n No. of sides used in circle polygon approximation: "
978 << v.fNoOfSides;
979
980 os << "\n Viewpoint direction: " << v.fViewpointDirection;
981
982 os << "\n Up vector: " << v.fUpVector;
983
984 os << "\n Field half angle: " << v.fFieldHalfAngle;
985
986 os << "\n Zoom factor: " << v.fZoomFactor;
987
988 os << "\n Scale factor: " << v.fScaleFactor;
989
990 os << "\n Current target point: " << v.fCurrentTargetPoint;
991
992 os << "\n Dolly distance: " << v.fDolly;
993
994 os << "\n Light ";
995 if (v.fLightsMoveWithCamera) os << "moves";
996 else os << "does not move";
997 os << " with camera";
998
999 os << "\n Relative lightpoint direction: "
1000 << v.fRelativeLightpointDirection;
1001
1002 os << "\n Actual lightpoint direction: "
1003 << v.fActualLightpointDirection;
1004
1005 os << "\n Derived parameters for standard view of object of unit radius:";
1006 G4ViewParameters tempVP = v;
1007 tempVP.fDolly = 0.;
1008 tempVP.fZoomFactor = 1.;
1009 const G4double radius = 1.;
1010 const G4double cameraDistance = tempVP.GetCameraDistance (radius);
1011 const G4double nearDistance =
1012 tempVP.GetNearDistance (cameraDistance, radius);
1013 const G4double farDistance =
1014 tempVP.GetFarDistance (cameraDistance, nearDistance, radius);
1015 const G4double right = tempVP.GetFrontHalfHeight (nearDistance, radius);
1016 os << "\n Camera distance: " << cameraDistance;
1017 os << "\n Near distance: " << nearDistance;
1018 os << "\n Far distance: " << farDistance;
1019 os << "\n Front half height: " << right;
1020
1021 os << "\n Default VisAttributes:\n " << v.fDefaultVisAttributes;
1022
1023 os << "\n Default TextVisAttributes:\n " << v.fDefaultTextVisAttributes;
1024
1025 os << "\n Default marker:\n " << v.fDefaultMarker;
1026
1027 os << "\n Global marker scale: " << v.fGlobalMarkerScale;
1028
1029 os << "\n Global lineWidth scale: " << v.fGlobalLineWidthScale;
1030
1031 os << "\n Marker ";
1032 if (v.fMarkerNotHidden) os << "not ";
1033 os << "hidden by surfaces.";
1034
1035 os << "\n Window size hint: "
1036 << v.fWindowSizeHintX << 'x'<< v.fWindowSizeHintX;
1037
1038 os << "\n X geometry string: " << v.fXGeometryString;
1039 os << "\n X geometry mask: "
1040 << std::showbase << std::hex << v.fGeometryMask
1041 << std::noshowbase << std::dec;
1042
1043 os << "\n Auto refresh: ";
1044 if (v.fAutoRefresh) os << "true";
1045 else os << "false";
1046
1047 os << "\n Background colour: " << v.fBackgroundColour;
1048
1049 os << "\n Picking requested: ";
1050 if (v.fPicking) os << "true";
1051 else os << "false";
1052
1053 os << "\n Rotation style: ";
1054 switch (v.fRotationStyle) {
1056 os << "constrainUpDirection (conventional HEP view)"; break;
1058 os << "freeRotation (Google-like rotation, using mouse-grab)"; break;
1059 default: os << "unrecognised"; break;
1060 }
1061
1062 os << "\nVis attributes modifiers: ";
1063 const std::vector<G4ModelingParameters::VisAttributesModifier>& vams =
1064 v.fVisAttributesModifiers;
1065 if (vams.empty()) {
1066 os << "None";
1067 } else {
1068 os << vams;
1069 }
1070
1071 os << "\nTime window parameters:"
1072 << "\n Start time: " << v.fTimeParameters.fStartTime/ns << " ns"
1073 << "\n End time: " << v.fTimeParameters.fEndTime/ns << " ns"
1074 << "\n Fade factor: " << v.fTimeParameters.fFadeFactor;
1075 if (!v.fTimeParameters.fDisplayHeadTime) {
1076 os << "\n Head time display not requested.";
1077 } else {
1078 os
1079 << "\n Head time position: "
1080 << v.fTimeParameters.fDisplayHeadTimeX << ' ' << v.fTimeParameters.fDisplayHeadTimeY
1081 << "\n Head time size: " << v.fTimeParameters.fDisplayHeadTimeSize
1082 << "\n Head time colour: " << v.fTimeParameters.fDisplayHeadTimeRed
1083 << ' ' << v.fTimeParameters.fDisplayHeadTimeGreen << ' ' << v.fTimeParameters.fDisplayHeadTimeBlue;
1084 }
1085 if (!v.fTimeParameters.fDisplayLightFront) {
1086 os << "\n Light front display not requested.";
1087 } else {
1088 os
1089 << "\n Light front position: "
1090 << v.fTimeParameters.fDisplayLightFrontX/mm << ' ' << v.fTimeParameters.fDisplayLightFrontY/mm
1091 << ' ' << v.fTimeParameters.fDisplayLightFrontZ/mm << " mm"
1092 << "\n Light front time: " << v.fTimeParameters.fDisplayLightFrontT/ns << " ns"
1093 << "\n Light front colour: " << v.fTimeParameters.fDisplayLightFrontRed
1094 << ' ' << v.fTimeParameters.fDisplayLightFrontGreen << ' ' << v.fTimeParameters.fDisplayLightFrontBlue;
1095 }
1096
1097 os << "\nSpecial Mesh Rendering";
1098 if (v.fSpecialMeshRendering) {
1099 os << " requested with option \"" << v.fSpecialMeshRenderingOption;
1100 os << "\" for ";
1101 if (v.fSpecialMeshVolumes.empty()) {
1102 os << "any mesh";
1103 } else {
1104 os << "selected meshes";
1105 for (const auto& vol: v.fSpecialMeshVolumes) {
1106 os << "\n " << vol.GetName() << ':' << vol.GetCopyNo();
1107 }
1108 }
1109 } else os << ": off";
1110
1111 os << "\nTransparency by depth: " << v.fTransparencyByDepth
1112 << ", option: " << v.fTransparencyByDepthOption;
1113
1114 os << "\nZoom to cursor requested: ";
1115 if (v.fZoomToCursor) os << "true";
1116 else os << "false";
1117
1118 os << "\nSmooth dots requested: ";
1119 if (v.fDotsSmooth) os << "true";
1120 else os << "false";
1121
1122 os << "\nDots size: " << v.fDotsSize;
1123
1124 return os;
1125}
#define G4BestUnit(a, b)
double G4double
Definition G4Types.hh:83
G4double GetCameraDistance(G4double radius) const
G4bool IsCutaway() const
G4double GetFarDistance(G4double cameraDistance, G4double nearDistance, G4double radius) const
G4double GetFrontHalfHeight(G4double nearDistance, G4double radius) const
G4double GetNearDistance(G4double cameraDistance, G4double radius) const
#define ns(x)
Definition xmltok.c:1649

◆ operator<<() [2/3]

std::ostream & operator<< ( std::ostream & os,
G4ViewParameters::DrawingStyle style )

Definition at line 887 of file G4ViewParameters.cc.

889{
890 switch (style) {
892 os << "wireframe"; break;
894 os << "hlr - hidden lines removed"; break;
896 os << "hsr - hidden surfaces removed"; break;
898 os << "hlhsr - hidden line, hidden surface removed"; break;
900 os << "cloud - draw volume as a cloud of dots"; break;
901 default: os << "unrecognised"; break;
902 }
903 return os;
904}

◆ operator<<() [3/3]

std::ostream & operator<< ( std::ostream & os,
G4ViewParameters::SMROption option )

Definition at line 906 of file G4ViewParameters.cc.

908{
909 switch (option) {
911 os << "default"; break;
913 os << "dots"; break;
915 os << "surfaces"; break;
916 }
917 return os;
918}