Ignore:
Timestamp:
06/10/08 13:15:59 (16 years ago)
Author:
mattausch
Message:
 
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 
    63*/ 
    74 
     
    1916 
    2017 
    21 //namespace GtpVisibilityPreprocessor { 
    22  
     18namespace CHCDemo  
     19{ 
     20 
     21struct Triangle3; 
    2322   
    2423#if defined(_MSC_VER) 
     
    5453#include <values.h> 
    5554#else // __WATCOMC__ 
    56 #define M_PI        3.14159265358979323846 
     55#define M_PI        3.14159265358979323846F 
    5756#define MAXFLOAT    3.40282347e+37F 
    5857#endif // __WATCOMC__ 
     
    119118#endif // NULL 
    120119 
    121 //ostream& operator<<(ostream &s,const BaseC &c); 
    122  
    123120typedef float Real; 
    124121typedef unsigned char byte; 
    125122 
    126 //#ifndef FALSE 
    127 //#define FALSE 0 
    128 //#define TRUE !0 
    129 //#endif 
    130  
    131 #ifndef __GNUG__ 
    132 // typedef int bool; 
    133 #endif 
    134123 
    135124#ifndef getch 
     
    137126#endif 
    138127 
    139  
    140128#define TRASH 1.0e-5 
    141129 
    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 
    153131#ifndef DEL_PTR 
    154132#define DEL_PTR(ptr) do {if (ptr) {        \ 
     
    157135                     while (0) 
    158136#endif 
     137 
     138 
    159139// Clears a container (i.e., a vector of pointers) and deletes the pointers 
    160 #if 0 
    161140#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) { \ 
    172142        DEL_PTR((co)[_i]);} \ 
    173143        (co).clear(); } \ 
     
    175145#endif 
    176146 
    177 #endif 
    178  
    179  
    180 inline 
    181 int signum(const Real a, const Real thresh = TRASH) 
     147 
     148inline int signum(const Real a, const Real thresh = TRASH) 
    182149{ 
    183150  if (a>thresh) 
     
    320287inline Real Deg2Rad(const Real a) 
    321288{ 
    322    return a * (PI / 180.0f); 
     289   return a * (M_PI / 180.0f); 
    323290} 
    324291 
    325292inline Real Rad2Deg(const Real a) { 
    326   return a*(180.0f/PI); 
     293  return a * (180.0f/M_PI); 
    327294} 
    328295   
     
    335302 
    336303 
    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*/ 
     308class Limits  
     309{ 
    344310public: 
    345   // This is the number used to reject too-close intersections. 
    346   // The default value is 1.0. 
    347   static Real Threshold; 
    348  
    349   // This is a "small" number.  Less than this number is assumed to 
    350   // be 0, when such things matter. 
    351   // The default value is 0.1. 
    352   static Real Small; 
    353  
    354   // This is an impractically "large" number, used for intersection 
    355   // parameters out to infinity (e.g. the span resulting from an 
    356   // FindAllIntersections operation on a plane). 
    357   // The default value is 100000. 
    358   static Real Infinity; 
     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; 
    359325}; 
    360326 
     
    488454 
    489455 
    490 //} 
    491  
    492 #endif 
    493  
    494  
    495  
    496  
    497  
    498  
    499  
    500  
     456typedef 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.