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[ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
  2 // See the file tools.license for terms.
  3 
  4 #ifndef tools_box_3f
  5 #define tools_box_3f
  6 
  7 #include "../mnmx"
  8 
  9 #include <cfloat> // FLT_MAX
 10 
 11 namespace tools {
 12 
 13 // optimization (used in exlib/sg/text_hershey) :
 14 
 15 inline void box_3f_make_empty(float& a_mn_x,float& a_mn_y,float& a_mn_z,
 16                              float& a_mx_x,float& a_mx_y,float& a_mx_z){
 17   a_mn_x = FLT_MAX;
 18   a_mn_y = FLT_MAX;
 19   a_mn_z = FLT_MAX;
 20   a_mx_x = -FLT_MAX;
 21   a_mx_y = -FLT_MAX;
 22   a_mx_z = -FLT_MAX;
 23 }
 24 inline void box_3f_extend_by(float& a_mn_x,float& a_mn_y,float& a_mn_z,
 25                             float& a_mx_x,float& a_mx_y,float& a_mx_z,
 26                             float a_x,float a_y,float a_z){
 27   if(a_mx_x<a_mn_x){ //is empty.
 28     a_mn_x = a_x;
 29     a_mn_y = a_y;
 30     a_mn_z = a_z;
 31 
 32     a_mx_x = a_x;
 33     a_mx_y = a_y;
 34     a_mx_z = a_z;
 35   } else {
 36     a_mn_x = mn<float>(a_x,a_mn_x);
 37     a_mn_y = mn<float>(a_y,a_mn_y);
 38     a_mn_z = mn<float>(a_z,a_mn_z);
 39 
 40     a_mx_x = mx<float>(a_x,a_mx_x);
 41     a_mx_y = mx<float>(a_y,a_mx_y);
 42     a_mx_z = mx<float>(a_z,a_mx_z);
 43   }
 44 }
 45 inline bool box_3f_is_empty(float a_mn_x,float a_mx_x) {
 46   return a_mx_x < a_mn_x;
 47 }
 48 
 49 }
 50 
 51 #endif