1161 if (views.size() < 2) {
1163 (
"G4ViewParameters::CatmullRomCubicSplineInterpolation",
1165 "There must be at least two views.");
1169 if (nInterpolationPoints < 1) {
1171 (
"G4ViewParameters::CatmullRomCubicSplineInterpolation",
1173 "Number of interpolation points cannot be zero or negative.");
1177 const size_t nIntervals = views.size() - 1;
1178 const G4double dt = 1./nInterpolationPoints;
1182 static G4int iInterpolationPoint = 0;
1183 static size_t iInterval = 0;
1188 const G4double h00 = 2.*t*t*t - 3.*t*t +1;
1189 const G4double h10 = t*t*t -2.*t*t + t;
1190 const G4double h01 = -2.*t*t*t + 3.*t*t;
1194 const size_t&
n = nIntervals;
1195 size_t& i = iInterval;
1196 const std::vector<G4ViewParameters>&
v = views;
1213 holdingValues = t < 0.5? v[i]: v[i+1];
1216 #define INTERPOLATE(param) \
1221 mi = v[1].param - v[0].param; \
1224 if (n == 1) mi1 = mi; \
1226 else mi1 = 0.5 * (v[2].param - v[0].param); \
1227 } else if (i >= n - 1) { \
1229 mi1 = v[i+1].param - v[i].param; \
1231 if (n == 1) mi = mi1; \
1233 else mi = 0.5 * (v[i+1].param - v[i-1].param); \
1236 mi = 0.5 * (v[i+1].param - v[i-1].param); \
1237 mi1 = 0.5 * (v[i+2].param - v[i ].param); \
1239 real = h00 * v[i].param + h10 * mi + h01 * v[i+1].param + h11 * mi1;
1243 if (real < 0.) real = 0.;
1244 holdingValues.fVisibleDensity = real;
1246 if (real < 0.) real = 0.;
1247 holdingValues.fExplodeFactor = real;
1249 if (real < 0.) real = 0.;
1250 holdingValues.fFieldHalfAngle = real;
1252 if (real < 0.) real = 0.;
1253 holdingValues.fZoomFactor = real;
1255 holdingValues.fDolly = real;
1257 if (real < 0.) real = 0.;
1258 holdingValues.fGlobalMarkerScale = real;
1260 if (real < 0.) real = 0.;
1261 holdingValues.fGlobalLineWidthScale = real;
1264 #define INTERPOLATEUNITVECTOR(vector) \
1265 INTERPOLATE(vector.x()); x = real; \
1266 INTERPOLATE(vector.y()); y = real; \
1267 INTERPOLATE(vector.z()); z = real;
1273 holdingValues.fRelativeLightpointDirection =
G4Vector3D(x,y,z).
unit();
1275 holdingValues.fActualLightpointDirection =
G4Vector3D(x,y,z).
unit();
1278 #define INTERPOLATEVECTOR(vector) \
1279 INTERPOLATE(vector.x()); x = real; \
1280 INTERPOLATE(vector.y()); y = real; \
1281 INTERPOLATE(vector.z()); z = real;
1283 holdingValues.fScaleFactor =
G4Vector3D(x,y,z);
1286 #define INTERPOLATEPOINT(point) \
1287 INTERPOLATE(point.x()); x = real; \
1288 INTERPOLATE(point.y()); y = real; \
1289 INTERPOLATE(point.z()); z = real;
1291 holdingValues.fExplodeCentre =
G4Point3D(x,y,z);
1293 holdingValues.fCurrentTargetPoint =
G4Point3D(x,y,z);
1297 #define INTERPOLATECOLOUR(colour) \
1298 INTERPOLATE(colour.GetRed()); red = real; \
1299 INTERPOLATE(colour.GetGreen()); green = real; \
1300 INTERPOLATE(colour.GetBlue()); blue = real; \
1301 INTERPOLATE(colour.GetAlpha()); alpha = real;
1304 holdingValues.fBackgroundColour =
G4Colour(red,green,blue,alpha);
1308 #define CONTINUITY(quantity) \
1309 continuous = false; \
1312 if (v[1].quantity == v[0].quantity) { \
1313 if (n == 1) continuous = true; \
1314 else if (v[2].quantity == v[0].quantity) \
1315 continuous = true; \
1317 } else if (i >= n - 1) { \
1318 if (v[i+1].quantity == v[i].quantity) { \
1319 if (n == 1) continuous = true; \
1320 else if (v[i+1].quantity == v[i-1].quantity) \
1321 continuous = true; \
1324 if (v[i-1].quantity == v[i].quantity && \
1325 v[i+1].quantity == v[i].quantity && \
1326 v[i+2].quantity == v[i].quantity) \
1327 continuous = true; \
1331 #define INTERPOLATEPLANE(plane) \
1332 INTERPOLATE(plane.a()); a = real; \
1333 INTERPOLATE(plane.b()); b = real; \
1334 INTERPOLATE(plane.c()); c = real; \
1335 INTERPOLATE(plane.d()); d = real;
1341 holdingValues.fSectionPlane =
G4Plane3D(a,b,c,d);
1345 if (v[i].fCutawayPlanes.size()) {
1348 for (
size_t j = 0; j < v[i].fCutawayPlanes.size(); ++j) {
1350 holdingValues.fCutawayPlanes[j] =
G4Plane3D(a,b,c,d);
1359 if (v[i].fVisAttributesModifiers.size()) {
1362 for (
size_t j = 0; j < v[i].fVisAttributesModifiers.size(); ++j) {
\
1363 CONTINUITY(fVisAttributesModifiers[j].GetPVNameCopyNoPath());
1365 CONTINUITY(fVisAttributesModifiers[j].GetVisAttributesSignifier());
1367 if (v[i].fVisAttributesModifiers[j].GetVisAttributesSignifier() ==
1370 workingVA = v[i].fVisAttributesModifiers[j].GetVisAttributes();
1372 holdingValues.fVisAttributesModifiers[j].SetVisAttributes(workingVA);
1381 iInterpolationPoint++;
1383 if (iInterpolationPoint > nInterpolationPoints) {
1384 iInterpolationPoint = 1;
1388 if (iInterval >= nIntervals) {
1389 iInterpolationPoint = 0;
1395 return &holdingValues;
void SetColour(const G4Colour &)
std::vector< ExP01TrackerHit * > a
#define INTERPOLATEUNITVECTOR(vector)
BasicVector3D< T > unit() const
#define INTERPOLATECOLOUR(colour)
HepGeom::Point3D< G4double > G4Point3D
HepGeom::Vector3D< G4double > G4Vector3D
#define INTERPOLATEPLANE(plane)
#define INTERPOLATEVECTOR(vector)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
#define INTERPOLATE(param)
HepGeom::Plane3D< G4double > G4Plane3D
static const G4double alpha
for(G4int i1=0;i1< theStableOnes.GetNumberOfIsotopes(static_cast< G4int >(anE->GetZ()));i1++)
#define INTERPOLATEPOINT(point)
#define CONTINUITY(quantity)