#ifndef __ADFCREATOR_DEBUG_FLAGS_H__ #define __ADFCREATOR_DEBUG_FLAGS_H__ #include #include using namespace std; // (Steve) Debugging flags and vars. // If you want something on, make sure to #define XXX 1 // I usually use #if instead of #ifdef, so it's not enough to just #define XXX. // The debugging switches. // If true, it will basically generate non-adaptive octrees. // So, it'll just stop when it hits the depth-limit //#define DEBUG_ALWAYS_SUBDIVIDE 1 // If true, the minimum-distance function will just be a sphere // distance function, instead of actually getting the min distance // to the STL model. //#define DEBUG_USE_SPHERE_INSTEAD_OF_STL 1 #define DEBUG_SPHERE_RADIUS 100.0 // You have to keep this uncommented even if USE_SPHERE isn't defined // Sometimes, you'll get incorrect mindistances for certain points, causing // ugly artifacts outside the object. Use this flag to debug those. //#define DEBUG_MINDISTSTL_WITH_POISON_PT 1 // Young will need this. But my raytracer currently does not support the extra data. // TODO - have a command line switch handle this. Ie. -nograd will suppress gradient output. #define OUTPUT_GRADIENT_VECTORS 1 // If there's a problem with a specific node, and u know the node's 000 corner pt, // use these flags to debug it. //#define DEBUG_SPECIFIC_NODE 1 //#define DEBUG_NODE_ORIGIN Point(112.500000, 112.500000, 112.500000, 1.0) //#define DEBUG_NODE_ORIGIN Point(0,0,0, 1.0) //#define DISABLE_NEG_BIAS 1 //-------------------------------- // Stuff here, u usually want on //-------------------------------- // Use a fixed distance tolerance criteria, as opposed to percentage error tolerance. // Usually want this on! #define USE_FIXED_DISTANCE_TOLERANCE 1 // This avoids unecessary subdivision for octree nodes that obviously // contain no surface. The containment check is conservative, but helps a lot. // Usually want this on! #define USE_CONTAINS_SURFACE_OPTIMIZATION 1 // For Young's COONS interpolation, the ADF needs to be balanced for it // to be continuous in some important ways. But in general, // the ADF doesn't need to be balanced. So you may want this off // when just testing for ADF correctness. #define MAINTAIN_BALANCED_ADF 1 // (Steve) This enables use of the "convex umbrella" algorithm, which is a more // robust way of calculting signs, and prevents most leaks. See write up for more details. // Usually want this on! #define USE_UMBRELLA_SDF_METHOD 1 // TODO the jitter amt should be rather..a jitter percentage. We should take the largest length of the bounding box of the model, // multiply by this (which should be a command line arg, default to 1%), then that's our jitter amt max. // This is usually 1.0 #define JITTER_BOX_HALF_LENGTH 1.0f // For point jittering //----------------------- // Extra debugging stuff - more user-friendly than dblog // Use the __** macros to write to the log file. // Use the __DB*(x) for quick debug logging. //----------------------- extern ofstream __logfile; #define __ADFCREATOR_LOG_FILENAME__ "txs.log" // This should NOT be commented out ever! These are legitimate warnings // that the user should know about. #define __WARN__(x) { \ __logfile << "** WARNING: " << x << endl; \ __logfile.flush(); \ std::cout << "** WARNING: " << x << endl; \ std::cout.flush(); \ } // And this is a legitimate error #define __ERROR__(x) { \ __logfile << "**** ERROR: " << x << endl; \ __logfile.flush(); \ std::cerr << "**** ERROR: " << x << endl; \ std::cerr.flush(); \ } // General logged msgs - these should be used sparingly!! Used too much, // they would drastically slow down performance. #define __LOG__(x) { \ __logfile << x << endl; \ __logfile.flush(); \ } // These should be used even less than log messages, since they are // printed to cout #define __STAT__(x) { \ cout << x << endl; \ __logfile << x << endl; \ __logfile.flush(); \ } //----------------------- // Comment out the BODY of these macros to disable them. // These should only be used for purely debugging msgs that can be // disabled for actual use. // These should NOT be used to print out user warnings. Use __WARN__ for those. // When debugging a new "problem", use or create a new __DB* macro. // This helps keep things manageable, so u don't just see TONS of debug // msgs when u enabling a single one of them - u can pick and choose which ones // to disable. //----------------------- // Note how we don't surround x with parenthesis! #define __DBa(x) { __logfile << x << std::endl << std::flush; } #define __DBb(x) // { __logfile << x << std::endl << std::flush; } #define __DBc(x) // { __logfile << x << std::endl << std::flush; } #define __DBd(x) // { __logfile << x << std::endl << std::flush; } #define __DBe(x) // { __logfile << x << std::endl << std::flush; } #define __DBf(x) // { __logfile << x << std::endl << std::flush; } void init_logging(); #endif /* __ADFCREATOR_DEBUG_FLAGS_H__ */