Closed kanition closed 3 years ago
Thank you for your amazing work! I'm learning it by myself.
I find there are different ways to compare floating-point numbers:
Using function CHECK_NE or others like it: https://github.com/mmp/pbrt-v3/blob/aaa552a4b9cbf9dccb71450f47b268e0ed6370e2/src/core/geometry.h#L252 But I couldn't found the definition of CHECK_NE. What's its implementation?
CHECK_NE
Using == or != directly: https://github.com/mmp/pbrt-v3/blob/aaa552a4b9cbf9dccb71450f47b268e0ed6370e2/src/core/transform.h#L149 https://github.com/mmp/pbrt-v3/blob/aaa552a4b9cbf9dccb71450f47b268e0ed6370e2/src/core/transform.h#L64 Why is the common way below not used here? Is there any special reason?
==
!=
#define EPSILON 0.000000000001 Float f = 0.0; if (f < EPSILON && f > -EPSILON) { //f == 0, do something } else { //f != 0, do something }
What's the scope of application of the strict equality and approximate equality in pbrt?
Thank you for your amazing work! I'm learning it by myself.
I find there are different ways to compare floating-point numbers:
Using function
CHECK_NE
or others like it: https://github.com/mmp/pbrt-v3/blob/aaa552a4b9cbf9dccb71450f47b268e0ed6370e2/src/core/geometry.h#L252 But I couldn't found the definition ofCHECK_NE
. What's its implementation?Using
==
or!=
directly: https://github.com/mmp/pbrt-v3/blob/aaa552a4b9cbf9dccb71450f47b268e0ed6370e2/src/core/transform.h#L149 https://github.com/mmp/pbrt-v3/blob/aaa552a4b9cbf9dccb71450f47b268e0ed6370e2/src/core/transform.h#L64 Why is the common way below not used here? Is there any special reason?What's the scope of application of the strict equality and approximate equality in pbrt?