Ignore:
Timestamp:
04/29/06 19:11:23 (18 years ago)
Author:
mattausch
Message:

working on preprocessor integration
added iv stuff

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/AxisAlignedBox3.h

    r860 r863  
    88#include "Containers.h" 
    99 
     10namespace GtpVisibilityPreprocessor { 
     11 
    1012class Ray; 
    1113class Polygon3; 
    1214class Mesh; 
    1315 
    14 // -------------------------------------------------------- 
    15 // CAABox class. 
    16 //  This is a box in 3-space, defined by min and max 
    17 //  corner vectors.  Many useful operations are defined 
    18 //  on this 
    19 // -------------------------------------------------------- 
     16/** 
     17        CAABox class. 
     18        This is a box in 3-space, defined by min and max 
     19        corner vectors.  Many useful operations are defined 
     20        on this 
     21*/ 
    2022class AxisAlignedBox3 
    2123{ 
    2224protected: 
    23   Vector3 mMin, mMax; 
     25        Vector3 mMin, mMax; 
    2426public: 
    2527  // Constructors. 
     
    3436  //                                                  max(center + Vector3(radius)) {} 
    3537 
    36   // initialization to the non existing bounding box 
     38  /** initialization to the non existing bounding box 
     39  */ 
    3740  void Initialize() { 
    3841    mMin = Vector3(MAXFLOAT); 
     
    4043  } 
    4144 
    42   // The center of the box 
     45  /** The center of the box 
     46  */ 
    4347  Vector3 Center() const { return 0.5 * (mMin + mMax); } 
    4448   
    45   // The diagonal of the box 
     49  /** The diagonal of the box 
     50  */ 
    4651  Vector3 Diagonal() const { return (mMax -mMin); } 
    4752 
     
    110115  void Include (const PolygonContainer &polys); 
    111116  void Include(Mesh *mesh); 
    112   // Expand the axis-aligned box to include given values in particular axis 
     117 
     118  /** Expand the axis-aligned box to include given values in particular axis. 
     119  */ 
    113120  void Include(const int &axis, const float &newBound); 
    114121 
     
    123130  friend inline bool OverlapS(const AxisAlignedBox3 &,const AxisAlignedBox3 &); 
    124131 
    125   // Overlap returns 1 if the two axis-aligned boxes overlap for a given 
    126   // epsilon. If eps > 0.0, then the boxes has to have the real intersection 
    127   // box, if eps < 0.0, then the boxes need not intersect really, they 
    128   // can be at eps distance in the projection 
     132  /** Overlap returns 1 if the two axis-aligned boxes overlap for a given 
     133          epsilon. If eps > 0.0, then the boxes has to have the real intersection 
     134          box, if eps < 0.0, then the boxes need not intersect really, they 
     135          can be at eps distance in the projection. 
     136          */ 
    129137  friend inline bool Overlap(const AxisAlignedBox3 &, 
    130                              const AxisAlignedBox3 &, 
    131                              float eps); 
    132  
    133   // Includes returns true if a includes b (completely 
     138                                                         const AxisAlignedBox3 &, 
     139                                                         float eps); 
     140 
     141  /** Returns 'factor' of overlap of first box with the second box. i.e., a number 
     142        between 0 (no overlap) and 1 (same box). 
     143  */ 
     144  friend inline float FactorOfOverlap(const AxisAlignedBox3 &, const AxisAlignedBox3 &); 
     145 
     146  /** Includes returns true if a includes b (completely) 
     147  */ 
    134148  bool Includes(const AxisAlignedBox3 &b) const; 
    135149 
    136150  virtual int IsInside(const Vector3 &v) const; 
    137151   
    138   // Test if the box is really sensefull 
     152  /** Test if the box makes sense. 
     153  */ 
    139154  virtual bool IsCorrect(); 
    140155 
    141   // To answer true requires the box of real volume of non-zero value 
     156  /** To answer true requires the box of real volume of non-zero value. 
     157  */ 
    142158  bool IsSingularOrIncorrect() const; 
    143159 
    144   // When the box is not of non-zero or negative surface area 
     160  /** When the box is not of non-zero or negative surface area. 
     161  */ 
    145162  bool IsCorrectAndNotPoint() const; 
    146163 
    147   // Returns true when the box degenerates to a point 
     164  /** Returns true when the box degenerates to a point. 
     165  */ 
    148166  bool IsPoint() const; 
    149167 
     168  /** Scales the box with the factor. 
     169  */ 
    150170  void Scale(const float scale) { 
    151171        Vector3 newSize = Size()*(scale*0.5f); 
     
    155175  } 
    156176   
     177  /** Returns the square of the minimal and maximal distance to  
     178        a point on the box. 
     179        */ 
    157180  void 
    158181  GetSqrDistances(const Vector3 &point, 
     
    348371          @returns true if ray hits the bounding box. 
    349372  */ 
    350   bool GetRaySegment(const Ray &ray,  
    351                                 float &minT,  
    352                                 float &maxT) const; 
     373  bool GetRaySegment(const Ray &ray, float &minT, float &maxT) const; 
    353374 
    354375  /** If the boxes are intersecting on a common face, this function  
     
    519540} 
    520541 
     542inline float FactorOfOverlap(const AxisAlignedBox3 &box1, const AxisAlignedBox3 &box2) 
     543{ 
     544        const AxisAlignedBox3 isect = Intersect(box1, box2); 
     545        return isect.GetVolume() / box1.GetVolume(); 
     546} 
    521547 
    522548inline int operator==(const AxisAlignedBox3 &A, const AxisAlignedBox3 &B) 
     
    526552 
    527553   
    528  
     554} 
    529555 
    530556 
Note: See TracChangeset for help on using the changeset viewer.