Geant4-11
Macros | Functions
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 CONTINUITY(quantity)
 
#define INTERPOLATE(param)
 
#define INTERPOLATECOLOUR(colour)
 
#define INTERPOLATELOG(param)
 
#define INTERPOLATEPLANE(plane)
 
#define INTERPOLATEPOINT(point)
 
#define INTERPOLATEUNITVECTOR(vector)
 
#define INTERPOLATEVECTOR(vector)
 

Functions

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

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; \
}

◆ 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;

◆ 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;
static const G4double alpha
#define INTERPOLATE(param)

◆ 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);

◆ 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;

◆ INTERPOLATEPOINT

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

◆ INTERPOLATEUNITVECTOR

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

◆ INTERPOLATEVECTOR

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

Function Documentation

◆ operator<<() [1/2]

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

Definition at line 889 of file G4ViewParameters.cc.

889 {
890 os << "View parameters and options:";
891
892 os << "\n Drawing style: " << v.fDrawingStyle;
893
894 os << "\n Number of cloud points: " << v.fNumberOfCloudPoints;
895
896 os << "\n Auxiliary edges: ";
897 if (!v.fAuxEdgeVisible) os << "in";
898 os << "visible";
899
900 os << "\n Culling: ";
901 if (v.fCulling) os << "on";
902 else os << "off";
903
904 os << "\n Culling invisible objects: ";
905 if (v.fCullInvisible) os << "on";
906 else os << "off";
907
908 os << "\n Density culling: ";
909 if (v.fDensityCulling) {
910 os << "on - invisible if density less than "
911 << v.fVisibleDensity / (1. * g / cm3) << " g cm^-3";
912 }
913 else os << "off";
914
915 os << "\n Culling daughters covered by opaque mothers: ";
916 if (v.fCullCovered) os << "on";
917 else os << "off";
918
919 os << "\n Colour by density: ";
920 if (v.fCBDAlgorithmNumber <= 0) {
921 os << "inactive";
922 } else {
923 os << "Algorithm " << v.fCBDAlgorithmNumber << ", Parameters:";
924 for (auto p: v.fCBDParameters) {
925 os << ' ' << G4BestUnit(p,"Volumic Mass");
926 }
927 }
928
929 os << "\n Section flag: ";
930 if (v.fSection) os << "true, section/cut plane: " << v.fSectionPlane;
931 else os << "false";
932
933 if (v.IsCutaway()) {
934 os << "\n Cutaway planes: ";
935 for (size_t i = 0; i < v.fCutawayPlanes.size (); i++) {
936 os << ' ' << v.fCutawayPlanes[i];
937 }
938 }
939 else {
940 os << "\n No cutaway planes";
941 }
942
943 os << "\n Explode factor: " << v.fExplodeFactor
944 << " about centre: " << v.fExplodeCentre;
945
946 os << "\n No. of sides used in circle polygon approximation: "
947 << v.fNoOfSides;
948
949 os << "\n Viewpoint direction: " << v.fViewpointDirection;
950
951 os << "\n Up vector: " << v.fUpVector;
952
953 os << "\n Field half angle: " << v.fFieldHalfAngle;
954
955 os << "\n Zoom factor: " << v.fZoomFactor;
956
957 os << "\n Scale factor: " << v.fScaleFactor;
958
959 os << "\n Current target point: " << v.fCurrentTargetPoint;
960
961 os << "\n Dolly distance: " << v.fDolly;
962
963 os << "\n Light ";
964 if (v.fLightsMoveWithCamera) os << "moves";
965 else os << "does not move";
966 os << " with camera";
967
968 os << "\n Relative lightpoint direction: "
970
971 os << "\n Actual lightpoint direction: "
973
974 os << "\n Derived parameters for standard view of object of unit radius:";
975 G4ViewParameters tempVP = v;
976 tempVP.fDolly = 0.;
977 tempVP.fZoomFactor = 1.;
978 const G4double radius = 1.;
979 const G4double cameraDistance = tempVP.GetCameraDistance (radius);
980 const G4double nearDistance =
981 tempVP.GetNearDistance (cameraDistance, radius);
982 const G4double farDistance =
983 tempVP.GetFarDistance (cameraDistance, nearDistance, radius);
984 const G4double right = tempVP.GetFrontHalfHeight (nearDistance, radius);
985 os << "\n Camera distance: " << cameraDistance;
986 os << "\n Near distance: " << nearDistance;
987 os << "\n Far distance: " << farDistance;
988 os << "\n Front half height: " << right;
989
990 os << "\n Default VisAttributes:\n " << v.fDefaultVisAttributes;
991
992 os << "\n Default TextVisAttributes:\n " << v.fDefaultTextVisAttributes;
993
994 os << "\n Default marker: " << v.fDefaultMarker;
995
996 os << "\n Global marker scale: " << v.fGlobalMarkerScale;
997
998 os << "\n Global lineWidth scale: " << v.fGlobalLineWidthScale;
999
1000 os << "\n Marker ";
1001 if (v.fMarkerNotHidden) os << "not ";
1002 os << "hidden by surfaces.";
1003
1004 os << "\n Window size hint: "
1005 << v.fWindowSizeHintX << 'x'<< v.fWindowSizeHintX;
1006
1007 os << "\n X geometry string: " << v.fXGeometryString;
1008 os << "\n X geometry mask: "
1009 << std::showbase << std::hex << v.fGeometryMask
1010 << std::noshowbase << std::dec;
1011
1012 os << "\n Auto refresh: ";
1013 if (v.fAutoRefresh) os << "true";
1014 else os << "false";
1015
1016 os << "\n Background colour: " << v.fBackgroundColour;
1017
1018 os << "\n Picking requested: ";
1019 if (v.fPicking) os << "true";
1020 else os << "false";
1021
1022 os << "\n Rotation style: ";
1023 switch (v.fRotationStyle) {
1025 os << "constrainUpDirection (conventional HEP view)"; break;
1027 os << "freeRotation (Google-like rotation, using mouse-grab)"; break;
1028 default: os << "unrecognised"; break;
1029 }
1030
1031 os << "\n Vis attributes modifiers: ";
1032 const std::vector<G4ModelingParameters::VisAttributesModifier>& vams =
1034 if (vams.empty()) {
1035 os << "None";
1036 } else {
1037 os << vams;
1038 }
1039
1040 os << "\n Time window parameters:"
1041 << "\n Start time: " << v.fStartTime/ns << " ns"
1042 << "\n End time: " << v.fEndTime/ns << " ns"
1043 << "\n Fade factor: " << v.fFadeFactor;
1044 if (!v.fDisplayHeadTime) {
1045 os << "\n Head time display not requested.";
1046 } else {
1047 os
1048 << "\n Head time position: "
1049 << v.fDisplayHeadTimeX << ' ' << v.fDisplayHeadTimeY
1050 << "\n Head time size: " << v.fDisplayHeadTimeSize
1051 << "\n Head time colour: " << v.fDisplayHeadTimeRed
1052 << ' ' << v.fDisplayHeadTimeGreen << ' ' << v.fDisplayHeadTimeBlue;
1053 }
1054 if (!v.fDisplayLightFront) {
1055 os << "\n Light front display not requested.";
1056 } else {
1057 os
1058 << "\n Light front position: "
1060 << ' ' << v.fDisplayLightFrontZ/mm << " mm"
1061 << "\n Light front time: " << v.fDisplayLightFrontT/ns << " ns"
1062 << "\n Light front colour: " << v.fDisplayLightFrontRed
1063 << ' ' << v.fDisplayLightFrontGreen << ' ' << v.fDisplayLightFrontBlue;
1064 }
1065
1066 os << "\n Special Mesh Rendering: ";
1067 if (v.fSpecialMeshRendering) {
1068 os << "on: ";
1069 if (v.fSpecialMeshVolumes.empty()) {
1070 os << "all meshes";
1071 } else {
1072 os << "selected meshes";
1073 for (const auto& vol: v.fSpecialMeshVolumes) {
1074 os << "\n " << vol.GetName() << ':' << vol.GetCopyNo();
1075 }
1076 }
1077 } else os << "off";
1078
1079 return os;
1080}
static constexpr double cm3
Definition: G4SIunits.hh:101
static constexpr double mm
Definition: G4SIunits.hh:95
static constexpr double g
Definition: G4SIunits.hh:168
#define G4BestUnit(a, b)
double G4double
Definition: G4Types.hh:83
G4Point3D fCurrentTargetPoint
G4double fDisplayLightFrontT
std::vector< G4ModelingParameters::VisAttributesModifier > fVisAttributesModifiers
G4double fDisplayLightFrontBlue
G4double GetCameraDistance(G4double radius) const
G4double fDisplayHeadTimeBlue
G4bool IsCutaway() const
std::vector< G4ModelingParameters::PVNameCopyNo > fSpecialMeshVolumes
G4double fDisplayLightFrontY
G4double fDisplayLightFrontRed
G4double fDisplayLightFrontGreen
DrawingStyle fDrawingStyle
G4double GetFarDistance(G4double cameraDistance, G4double nearDistance, G4double radius) const
G4double GetFrontHalfHeight(G4double nearDistance, G4double radius) const
G4Vector3D fViewpointDirection
std::vector< G4double > fCBDParameters
G4double fDisplayHeadTimeGreen
G4double fDisplayLightFrontX
G4double fGlobalLineWidthScale
G4VisAttributes fDefaultTextVisAttributes
G4double fDisplayHeadTimeSize
G4Vector3D fRelativeLightpointDirection
G4VisAttributes fDefaultVisAttributes
G4double fDisplayHeadTimeRed
G4double fDisplayLightFrontZ
G4double GetNearDistance(G4double cameraDistance, G4double radius) const
G4Vector3D fActualLightpointDirection
RotationStyle fRotationStyle
#define ns
Definition: xmlparse.cc:614

◆ operator<<() [2/2]

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

Definition at line 870 of file G4ViewParameters.cc.

872{
873 switch (style) {
875 os << "wireframe"; break;
877 os << "hlr - hidden lines removed"; break;
879 os << "hsr - hidden surfaces removed"; break;
881 os << "hlhsr - hidden line, hidden surface removed"; break;
883 os << "cloud - draw volume as a cloud of dots"; break;
884 default: os << "unrecognised"; break;
885 }
886 return os;
887}