22     debug(BLUE + 
"Precision Being Required to Consider Two numbers Equal: {0:.2e}".
format(_epsilon) + ENDC)
 
   34         info(
'Testing Intersection Between Half-Line & AABox')
 
   39         for y 
in range(tests):
 
   51             if ( (pick > 0.33) 
and (pick < 0.67) ) : side = 1
 
   52             if ( pick > 0.67 ) : side = 2
 
   56             if ( 
random() < 0.5 ) : direction = -1
 
   61             if ( direction == -1 ) :
 
   78             pt1_v = iAlgo.Intersection(box,lin)
 
   79             intersectT_f += (
time()-tim)
 
   80             pt2_v = iAlgo.Intersection(lin,box)
 
   81             if pt1_v.size(): pt1 = pt1_v[0]
 
   82             if pt2_v.size(): pt2 = pt2_v[0]
 
   85             if not ( np.abs(answer-a1) < _epsilon ) : success_f = 0
 
   86             if not ( np.abs(answer-a2) < _epsilon ) : success_f = 0
 
   88                 if not ( np.abs(pt1[x]-i[x]) < _epsilon) : success_f = 0
 
   89                 if not ( np.abs(pt1[x]-i[x]) < _epsilon) : success_f = 0
 
   90             totSuccess_f += success_f
 
   98             pt1_v = iAlgo.Intersection(box,lin,1)
 
   99             intersectT_b += (
time()-tim)
 
  100             pt2_v = iAlgo.Intersection(lin,box,1)
 
  101             if pt1_v.size(): pt1 = pt1_v[0]
 
  102             if pt2_v.size(): pt2 = pt2_v[0]
 
  105             if not ( np.abs(answer-a1) < _epsilon ) : success_b = 0
 
  106             if not ( np.abs(answer-a2) < _epsilon ) : success_b = 0
 
  108                 if not ( np.abs(pt1[x]-i[x]) < _epsilon) : success_b = 0
 
  109                 if not ( np.abs(pt1[x]-i[x]) < _epsilon) : success_b = 0
 
  110             if (success_b == 1) : totSuccess_b += 1
 
  112         if ( float(totSuccess_f)/tests < 1):
 
  113             info(NO + 
"Success: {0}%".
format(100*float(totSuccess_f)/tests) + ENDC)
 
  115             info(OK + 
"Success: {0}%".
format(100*float(totSuccess_f)/tests) + ENDC)
 
  116         info(
"Time for Intersection                    : {0:.3f} us".
format(1E6*intersectT_f/tests))
 
  117         if ( float(totSuccess_b)/tests < 1):
 
  118             info(NO + 
"Success: {0}%".
format(100*float(totSuccess_b)/tests) + ENDC)
 
  120             info(OK + 
"Success: {0}%".
format(100*float(totSuccess_b)/tests) + ENDC)
 
  121         info(
"Time for Intersection                    : {0:.3f} us".
format(1E6*intersectT_b/tests))
 
  125         error(
'geoalgo::IntersectAlgo unit test failed.')
 
  126         print traceback.format_exception(*sys.exc_info())[2]
 
  129     info(
'geoalgo::IntersectAlgo unit test complete.')
 
 
static std::string format(PyObject *obj, unsigned int pos, unsigned int indent, unsigned int maxlen, unsigned int depth)
 
Representation of a 3D rectangular box which sides are aligned w/ coordinate axis. A representation of an Axis-Aligned-Boundary-Box, a simple & popular representation of  3D boundary box for collision detection. The concept was taken from the reference,  Real-Time-Collision-Detection (RTCD), and in particular Ch. 4.2 (page 77):  .