BRL-CAD's math library provides two macros, NEAR_ZERO() and NEAR_EQUAL() that test whether a number is approximately "0" or whether two numbers are approximately equal to each other. The numbers are "approximately" zero or equal based on a specified tolerance value. We recently added new macros that simplify caller use, but they need to be propagated throughout the code. NEAR_ZERO() has existed for a LOT longer than NEAR_EQUAL() and EQUAL() so code needs to be updated.
This task involves going through and reviewing all calls to NEAR_ZERO() and for cases where there's a subtraction of two numbers occurring, the call gets converted to a NEAR_EQUAL() or EQUAL() comparison. It's only the latter if the tolerance is SMALL_FASTF and is undocumented. IF there is a comment nearby that mentions the tolerance, you're going to only convert it to NEAR_EQUAL() and retain the tolerance.
Submit your work as a single patch file against our latest SVN sources with all changes included. See http://brlcad.org/wiki/Deuces to get started and help making patches.
File name/URL | File size | Date submitted | |
---|---|---|---|
macro.patch | 4.6 KB | December 16 2012 02:07 UTC | |
macro2.patch | 56.3 KB | December 16 2012 20:49 UTC |
I would like to work on this task.
This task has been assigned to Tony Jojan. You have 72 hours to complete this task, good luck!
The claim on this task has been removed, someone else can claim it now.
I would like to work on this task.
I've come across some files where a ZERO() macro is defined, where the tolerance is set to be SMALL_FASTF for all calls. If this macro is called with a subtraction of arguements, should I change it to EQUAL(), or should I leave calls to ZERO() alone?
This task has been assigned to javamonn. You have 72 hours to complete this task, good luck!
The work on this task is ready to be reviewed.
The patch right now doesn't change calls to ZERO(). Let me know if you want me to add that in.
Thanks,
Daniel
Yes, please also update the (relatively new) ZERO() calls as well just like the NEAR_ZERO() ones.
Note the highly related other macro task:
http://www.google-melange.com/gci/task/view/google/gci2012/8007240
You may be interested in claiming that one as well after completing this one.
Alright, I edited the appropiate calls to ZERO() and replaced them with EQUAL(). This is ready for review now. And thanks for the heads up, I'll pick that one up as soon as this is marked as complete.
Thanks,
Daniel
A quick review and test application of the patch and everything looks perfect. Nicely done!
If you provide your full name (if you haven't already), I'll be sure you're properly credited in our authorship documentation.
Congratulations, this task has been completed successfully.
Full name: Daniel Ramirez
Thanks!