21 debug(BLUE +
"Precision Being Required to Consider Two numbers Equal: {0:.2e}".
format(_epsilon) + ENDC)
33 info(
'Testing Intersection Between Half-Line & AABox')
38 for y
in range(tests):
50 if ( (pick > 0.33)
and (pick < 0.67) ) : side = 1
51 if ( pick > 0.67 ) : side = 2
55 if (
random() < 0.5 ) : direction = -1
60 if ( direction == -1 ) :
77 pt1_v = iAlgo.Intersection(box,lin)
78 intersectT_f += (
time()-tim)
79 pt2_v = iAlgo.Intersection(lin,box)
80 if pt1_v.size(): pt1 = pt1_v[0]
81 if pt2_v.size(): pt2 = pt2_v[0]
84 if not ( np.abs(answer-a1) < _epsilon ) : success_f = 0
85 if not ( np.abs(answer-a2) < _epsilon ) : success_f = 0
87 if not ( np.abs(pt1[x]-i[x]) < _epsilon) : success_f = 0
88 if not ( np.abs(pt1[x]-i[x]) < _epsilon) : success_f = 0
89 totSuccess_f += success_f
97 pt1_v = iAlgo.Intersection(box,lin,1)
98 intersectT_b += (
time()-tim)
99 pt2_v = iAlgo.Intersection(lin,box,1)
100 if pt1_v.size(): pt1 = pt1_v[0]
101 if pt2_v.size(): pt2 = pt2_v[0]
104 if not ( np.abs(answer-a1) < _epsilon ) : success_b = 0
105 if not ( np.abs(answer-a2) < _epsilon ) : success_b = 0
107 if not ( np.abs(pt1[x]-i[x]) < _epsilon) : success_b = 0
108 if not ( np.abs(pt1[x]-i[x]) < _epsilon) : success_b = 0
109 if (success_b == 1) : totSuccess_b += 1
111 if (
float(totSuccess_f)/tests < 1):
112 info(NO +
"Success: {0}%".
format(100*
float(totSuccess_f)/tests) + ENDC)
114 info(OK +
"Success: {0}%".
format(100*
float(totSuccess_f)/tests) + ENDC)
115 info(
"Time for Intersection : {0:.3f} us".
format(1E6*intersectT_f/tests))
116 if (
float(totSuccess_b)/tests < 1):
117 info(NO +
"Success: {0}%".
format(100*
float(totSuccess_b)/tests) + ENDC)
119 info(OK +
"Success: {0}%".
format(100*
float(totSuccess_b)/tests) + ENDC)
120 info(
"Time for Intersection : {0:.3f} us".
format(1E6*intersectT_b/tests))
124 error(
'geoalgo::IntersectAlgo unit test failed.')
125 print traceback.format_exception(*sys.exc_info())[2]
128 info(
'geoalgo::IntersectAlgo unit test complete.')
Algorithm to compute various geometrical relation among geometrical objects. In particular functions ...
static bool format(QChar::Decomposition tag, QString &str, int index, int len)
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): .
Representation of a 3D semi-infinite line. Defines a semi-infinite 3D line by having a start point (P...