Warning, /include/Geant4/tools/lina/box_3f is written in an unsupported language. File is not indexed.
0001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
0002 // See the file tools.license for terms.
0003
0004 #ifndef tools_box_3f
0005 #define tools_box_3f
0006
0007 #include "../mnmx"
0008
0009 #include <cfloat> // FLT_MAX
0010
0011 namespace tools {
0012
0013 // optimization (used in exlib/sg/text_hershey) :
0014
0015 inline void box_3f_make_empty(float& a_mn_x,float& a_mn_y,float& a_mn_z,
0016 float& a_mx_x,float& a_mx_y,float& a_mx_z){
0017 a_mn_x = FLT_MAX;
0018 a_mn_y = FLT_MAX;
0019 a_mn_z = FLT_MAX;
0020 a_mx_x = -FLT_MAX;
0021 a_mx_y = -FLT_MAX;
0022 a_mx_z = -FLT_MAX;
0023 }
0024 inline void box_3f_extend_by(float& a_mn_x,float& a_mn_y,float& a_mn_z,
0025 float& a_mx_x,float& a_mx_y,float& a_mx_z,
0026 float a_x,float a_y,float a_z){
0027 if(a_mx_x<a_mn_x){ //is empty.
0028 a_mn_x = a_x;
0029 a_mn_y = a_y;
0030 a_mn_z = a_z;
0031
0032 a_mx_x = a_x;
0033 a_mx_y = a_y;
0034 a_mx_z = a_z;
0035 } else {
0036 a_mn_x = mn<float>(a_x,a_mn_x);
0037 a_mn_y = mn<float>(a_y,a_mn_y);
0038 a_mn_z = mn<float>(a_z,a_mn_z);
0039
0040 a_mx_x = mx<float>(a_x,a_mx_x);
0041 a_mx_y = mx<float>(a_y,a_mx_y);
0042 a_mx_z = mx<float>(a_z,a_mx_z);
0043 }
0044 }
0045 inline bool box_3f_is_empty(float a_mn_x,float a_mx_x) {
0046 return a_mx_x < a_mn_x;
0047 }
0048
0049 }
0050
0051 #endif