Changeset 2751 for GTP/trunk/App/Demos/Vis/CHC_revisited/common.h
- Timestamp:
- 06/10/08 13:15:59 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/CHC_revisited/common.h
r2746 r2751 1 /** 2 3 This file contains various macros, templates and constants for the ERS system. 4 5 @author Jiri Bittner 1 /** This file contains various macros, templates and constants for the ERS system. 2 @author Jiri Bittner 6 3 */ 7 4 … … 19 16 20 17 21 //namespace GtpVisibilityPreprocessor { 22 18 namespace CHCDemo 19 { 20 21 struct Triangle3; 23 22 24 23 #if defined(_MSC_VER) … … 54 53 #include <values.h> 55 54 #else // __WATCOMC__ 56 #define M_PI 3.14159265358979323846 55 #define M_PI 3.14159265358979323846F 57 56 #define MAXFLOAT 3.40282347e+37F 58 57 #endif // __WATCOMC__ … … 119 118 #endif // NULL 120 119 121 //ostream& operator<<(ostream &s,const BaseC &c);122 123 120 typedef float Real; 124 121 typedef unsigned char byte; 125 122 126 //#ifndef FALSE127 //#define FALSE 0128 //#define TRUE !0129 //#endif130 131 #ifndef __GNUG__132 // typedef int bool;133 #endif134 123 135 124 #ifndef getch … … 137 126 #endif 138 127 139 140 128 #define TRASH 1.0e-5 141 129 142 #ifndef PI 143 #define PI 3.14159265358979323846f 144 #endif 145 146 #define MIN_FLOAT -1e30f 147 #define MAX_FLOAT 1e30f 148 149 150 // tolerance value for polygon area 151 #define AREA_LIMIT 0.0001f 152 130 // delete a pointer and set to NULL 153 131 #ifndef DEL_PTR 154 132 #define DEL_PTR(ptr) do {if (ptr) { \ … … 157 135 while (0) 158 136 #endif 137 138 159 139 // Clears a container (i.e., a vector of pointers) and deletes the pointers 160 #if 0161 140 #ifndef CLEAR_CONTAINER 162 #define CLEAR_CONTAINER(co) do { while (!(co).empty()) { \ 163 DEL_PTR((co).back()); \ 164 (co).pop_back();}} \ 165 while (0) 166 #endif 167 168 #else 169 170 #ifndef CLEAR_CONTAINER 171 #define CLEAR_CONTAINER(co) do { for (int _i = 0; _i < (int)(co).size(); ++ _i) { \ 141 #define CLEAR_CONTAINER(co) do { for (size_t _i = 0; _i < (int)(co).size(); ++ _i) { \ 172 142 DEL_PTR((co)[_i]);} \ 173 143 (co).clear(); } \ … … 175 145 #endif 176 146 177 #endif 178 179 180 inline 181 int signum(const Real a, const Real thresh = TRASH) 147 148 inline int signum(const Real a, const Real thresh = TRASH) 182 149 { 183 150 if (a>thresh) … … 320 287 inline Real Deg2Rad(const Real a) 321 288 { 322 return a * ( PI / 180.0f);289 return a * (M_PI / 180.0f); 323 290 } 324 291 325 292 inline Real Rad2Deg(const Real a) { 326 return a *(180.0f/PI);293 return a * (180.0f/M_PI); 327 294 } 328 295 … … 335 302 336 303 337 // ------------------------------------------------------------------- 338 // Limits. 339 // This class encapsulates all the concessions to Realing-point 340 // error made by ray tracers. 341 // ------------------------------------------------------------------- 342 343 class Limits { 304 /** Limits. 305 This class encapsulates all the concessions to Realing-point 306 error made by ray tracers. 307 */ 308 class Limits 309 { 344 310 public: 345 346 347 348 349 350 351 352 353 354 355 356 357 358 311 // This is the number used to reject too-close intersections. 312 // The default value is 1.0. 313 static Real Threshold; 314 315 // This is a "small" number. Less than this number is assumed to 316 // be 0, when such things matter. 317 // The default value is 0.1. 318 static Real Small; 319 320 // This is an impractically "large" number, used for intersection 321 // parameters out to infinity (e.g. the span resulting from an 322 // FindAllIntersections operation on a plane). 323 // The default value is 100000. 324 static Real Infinity; 359 325 }; 360 326 … … 488 454 489 455 490 //} 491 492 #endif 493 494 495 496 497 498 499 500 456 typedef std::vector<Triangle3> TriangleContainer; 457 458 } 459 460 #endif 461 462 463 464 465 466 467 468
Note: See TracChangeset
for help on using the changeset viewer.