1010// / @parblock
1111// /
1212// / Persistence of Vision Ray Tracer ('POV-Ray') version 3.8.
13- // / Copyright 1991-2018 Persistence of Vision Raytracer Pty. Ltd.
13+ // / Copyright 1991-2019 Persistence of Vision Raytracer Pty. Ltd.
1414// /
1515// / POV-Ray is free software: you can redistribute it and/or modify
1616// / it under the terms of the GNU Affero General Public License as
@@ -55,8 +55,6 @@ namespace pov
5555* Local preprocessor defines
5656******************************************************************************/
5757
58- const DBL Cone_Tolerance = 1.0e-9 ;
59-
6058#define close (x, y ) (fabs(x-y) < EPSILON ? 1 : 0 )
6159
6260/* Part of the cone/cylinder hit. [DB 9/94] */
@@ -186,15 +184,17 @@ int Cone::Intersect(const BasicRay& ray, CONE_INT *Intersection, TraceThreadData
186184
187185 z = P[Z] + t1 * D[Z];
188186
189- if ((t1 > Cone_Tolerance) && (t1 < MAX_DISTANCE) && (z >= 0.0 ) && (z <= 1.0 ))
187+ if ((t1 > gkMinIsectDepthReturned) && (t1 < MAX_DISTANCE) &&
188+ (z >= 0.0 ) && (z <= 1.0 ))
190189 {
191190 Intersection[i].d = t1 / len;
192191 Intersection[i++].t = SIDE_HIT;
193192 }
194193
195194 z = P[Z] + t2 * D[Z];
196195
197- if ((t2 > Cone_Tolerance) && (t2 < MAX_DISTANCE) && (z >= 0.0 ) && (z <= 1.0 ))
196+ if ((t2 > gkMinIsectDepthReturned) && (t2 < MAX_DISTANCE) &&
197+ (z >= 0.0 ) && (z <= 1.0 ))
198198 {
199199 Intersection[i].d = t2 / len;
200200 Intersection[i++].t = SIDE_HIT;
@@ -222,7 +222,8 @@ int Cone::Intersect(const BasicRay& ray, CONE_INT *Intersection, TraceThreadData
222222
223223 z = P[Z] + t1 * D[Z];
224224
225- if ((t1 > Cone_Tolerance) && (t1 < MAX_DISTANCE) && (z >= dist) && (z <= 1.0 ))
225+ if ((t1 > gkMinIsectDepthReturned) && (t1 < MAX_DISTANCE) &&
226+ (z >= dist) && (z <= 1.0 ))
226227 {
227228 Intersection[i].d = t1 / len;
228229 Intersection[i++].t = SIDE_HIT;
@@ -244,15 +245,17 @@ int Cone::Intersect(const BasicRay& ray, CONE_INT *Intersection, TraceThreadData
244245
245246 z = P[Z] + t1 * D[Z];
246247
247- if ((t1 > Cone_Tolerance) && (t1 < MAX_DISTANCE) && (z >= dist) && (z <= 1.0 ))
248+ if ((t1 > gkMinIsectDepthReturned) && (t1 < MAX_DISTANCE) &&
249+ (z >= dist) && (z <= 1.0 ))
248250 {
249251 Intersection[i].d = t1 / len;
250252 Intersection[i++].t = SIDE_HIT;
251253 }
252254
253255 z = P[Z] + t2 * D[Z];
254256
255- if ((t2 > Cone_Tolerance) && (t2 < MAX_DISTANCE) && (z >= dist) && (z <= 1.0 ))
257+ if ((t2 > gkMinIsectDepthReturned) && (t2 < MAX_DISTANCE) &&
258+ (z >= dist) && (z <= 1.0 ))
256259 {
257260 Intersection[i].d = t2 / len;
258261 Intersection[i++].t = SIDE_HIT;
@@ -269,7 +272,7 @@ int Cone::Intersect(const BasicRay& ray, CONE_INT *Intersection, TraceThreadData
269272
270273 b = (P[Y] + d * D[Y]);
271274
272- if (((Sqr (a) + Sqr (b)) <= 1.0 ) && (d > Cone_Tolerance ) && (d < MAX_DISTANCE))
275+ if (((Sqr (a) + Sqr (b)) <= 1.0 ) && (d > gkMinIsectDepthReturned ) && (d < MAX_DISTANCE))
273276 {
274277 Intersection[i].d = d / len;
275278 Intersection[i++].t = CAP_HIT;
@@ -282,7 +285,7 @@ int Cone::Intersect(const BasicRay& ray, CONE_INT *Intersection, TraceThreadData
282285 b = (P[Y] + d * D[Y]);
283286
284287 if ((Sqr (a) + Sqr (b)) <= (Test_Flag (this , CYLINDER_FLAG) ? 1.0 : Sqr (dist))
285- && (d > Cone_Tolerance ) && (d < MAX_DISTANCE))
288+ && (d > gkMinIsectDepthReturned ) && (d < MAX_DISTANCE))
286289 {
287290 Intersection[i].d = d / len;
288291 Intersection[i++].t = BASE_HIT;
0 commit comments