Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/ode/ode-0.9/OPCODE/Ice/IceIndexedTriangle.h @ 216

Last change on this file since 216 was 216, checked in by mathiask, 16 years ago

[Physik] add ode-0.9

File size: 3.3 KB
Line 
1///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2/**
3 *      Contains a handy indexed triangle class.
4 *      \file           IceIndexedTriangle.h
5 *      \author         Pierre Terdiman
6 *      \date           January, 17, 2000
7 */
8///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
9
10///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
11// Include Guard
12#ifndef __ICEINDEXEDTRIANGLE_H__
13#define __ICEINDEXEDTRIANGLE_H__
14
15        // Forward declarations
16#ifdef _MSC_VER
17        enum CubeIndex;
18#else
19        typedef int CubeIndex;
20#endif
21
22        // An indexed triangle class.
23        class ICEMATHS_API IndexedTriangle
24        {
25                public:
26                //! Constructor
27                inline_                                 IndexedTriangle()                                                                       {}
28                //! Constructor
29                inline_                                 IndexedTriangle(udword r0, udword r1, udword r2)        { mVRef[0]=r0; mVRef[1]=r1; mVRef[2]=r2; }
30                //! Copy constructor
31                inline_                                 IndexedTriangle(const IndexedTriangle& triangle)
32                                                                {
33                                                                        mVRef[0] = triangle.mVRef[0];
34                                                                        mVRef[1] = triangle.mVRef[1];
35                                                                        mVRef[2] = triangle.mVRef[2];
36                                                                }
37                //! Destructor
38                inline_                                 ~IndexedTriangle()                                                                      {}
39                //! Vertex-references
40                                udword                  mVRef[3];
41
42                // Methods
43                                void                    Flip();
44                                float                   Area(const Point* verts)                                                                                        const;
45                                float                   Perimeter(const Point* verts)                                                                           const;
46                                float                   Compacity(const Point* verts)                                                                           const;
47                                void                    Normal(const Point* verts, Point& normal)                                                       const;
48                                void                    DenormalizedNormal(const Point* verts, Point& normal)                           const;
49                                void                    Center(const Point* verts, Point& center)                                                       const;
50                                void                    CenteredNormal(const Point* verts, Point& normal)                                       const;
51                                void                    RandomPoint(const Point* verts, Point& random)                                          const;
52                                bool                    IsVisible(const Point* verts, const Point& source)                                      const;
53                                bool                    BackfaceCulling(const Point* verts, const Point& source)                        const;
54                                float                   ComputeOcclusionPotential(const Point* verts, const Point& view)        const;
55                                bool                    ReplaceVertex(udword oldref, udword newref);
56                                bool                    IsDegenerate()                                                                                                          const;
57                                bool                    HasVertex(udword ref)                                                                                           const;
58                                bool                    HasVertex(udword ref, udword* index)                                                            const;
59                                ubyte                   FindEdge(udword vref0, udword vref1)                                                            const;
60                                udword                  OppositeVertex(udword vref0, udword vref1)                                                      const;
61                inline_ udword                  OppositeVertex(ubyte edgenb)                                                                            const   { return mVRef[2-edgenb];       }
62                                void                    GetVRefs(ubyte edgenb, udword& vref0, udword& vref1, udword& vref2)     const;
63                                float                   MinEdgeLength(const Point* verts)                                                                       const;
64                                float                   MaxEdgeLength(const Point* verts)                                                                       const;
65                                void                    ComputePoint(const Point* verts, float u, float v, Point& pt, udword* nearvtx=null)     const;
66                                float                   Angle(const IndexedTriangle& tri, const Point* verts)                           const;
67                inline_ Plane                   PlaneEquation(const Point* verts)                                                                       const   { return Plane(verts[mVRef[0]], verts[mVRef[1]], verts[mVRef[2]]);      }
68                                bool                    Equal(const IndexedTriangle& tri)                                                                       const;
69                                CubeIndex               ComputeCubeIndex(const Point* verts)                                                            const;
70        };
71
72#endif // __ICEINDEXEDTRIANGLE_H__
Note: See TracBrowser for help on using the repository browser.