CMS 3D CMS Logo

IgBSPTriangle.h

Go to the documentation of this file.
00001 #ifndef IG_OPEN_INVENTOR_IG_BSP_TRIANGLE_H
00002 # define IG_OPEN_INVENTOR_IG_BSP_TRIANGLE_H
00003 
00004 //<<<<<< INCLUDES                                                       >>>>>>
00005 
00006 # include "Iguana/Inventor/interface/config.h"
00007 # include <Inventor/SbLinear.h>
00008 # include <list>
00009 
00010 //<<<<<< PUBLIC DEFINES                                                 >>>>>>
00011 //<<<<<< PUBLIC CONSTANTS                                               >>>>>>
00012 //<<<<<< PUBLIC TYPES                                                   >>>>>>
00013 //<<<<<< PUBLIC VARIABLES                                               >>>>>>
00014 //<<<<<< PUBLIC FUNCTIONS                                               >>>>>>
00015 //<<<<<< CLASS DECLARATIONS                                             >>>>>>
00016 
00017 class IG_OPEN_INVENTOR_API IgBSPTriangle
00018 {
00019 public:
00020     struct LessArea
00021     {
00022         bool operator ()(IgBSPTriangle *a, IgBSPTriangle *b);   
00023     };
00024 
00025     struct MoreArea
00026     {
00027         bool operator ()(IgBSPTriangle *a, IgBSPTriangle *b);   
00028     };
00029     
00030     
00031     enum 
00032     { 
00033         POINT_A = 1,
00034         POINT_B = 2,
00035         POINT_C = 4,
00036         ALL_POINTS = 7
00037     };    
00038     
00039     typedef std::list<IgBSPTriangle *> List;
00040     IgBSPTriangle (const SbVec3f &a, const SbVec3f &b, const SbVec3f &c);
00041     IgBSPTriangle (const IgBSPTriangle &t);
00042 
00043     int evaluateCoplanarMask (const SbPlane &plane);    
00044     int evaluateInHalfPlaneMask (const SbPlane &plane);
00045     float area (void);
00046     
00047     static bool areCoplanar (int coplanarMask);
00048     static bool isInFront (int coplanarMask, int inHalfPlaneMask);
00049     static bool isInBack (int coplanarMask, int inHalfPlaneMask);
00050     static bool areIntersecting (int coplanarMask, int inHalfPlaneMask);
00051     static void largestOnTop (List &triangleList);
00052     
00053     const SbVec3f       &v (int n) const;
00054     bool                good (void) const;    
00055     SbVec3f             barycenter (void) const;    
00056     void                split (const SbPlane &plane, 
00057                                IgBSPTriangle::List &result,
00058                                int coplanarMask,
00059                                int inFrontMask);    
00060 
00061     void                ref (void);
00062     void                unref (void);    
00063     static void         unrefAndDeleteTriangles(IgBSPTriangle::List &triangles);
00064     static void         unrefAndDeleteTriangle(IgBSPTriangle *triangle);
00065 protected:
00066     ~IgBSPTriangle (void);    
00067 private:
00068     SbVec3f     m_vertex[3];    
00069     unsigned int        m_refCounter;    
00070 };
00071 
00072 std::ostream &
00073 operator<< (std::ostream &stream, const IgBSPTriangle &triangle);
00074 
00075 //<<<<<< INLINE PUBLIC FUNCTIONS                                        >>>>>>
00076 //<<<<<< INLINE MEMBER FUNCTIONS                                        >>>>>>
00077 
00078 #endif // IG_OPEN_INVENTOR_IG_BSP_TRIANGLE_H

Generated on Tue Jun 9 17:38:42 2009 for CMSSW by  doxygen 1.5.4