Go to the documentation of this file.00001
00002
00008
00009
00011
00012 #ifndef __ICEINDEXEDTRIANGLE_H__
00013 #define __ICEINDEXEDTRIANGLE_H__
00014
00015
00016 #ifdef _MSC_VER
00017 enum CubeIndex;
00018 #else
00019 typedef int CubeIndex;
00020 #endif
00021
00022
00023 class ICEMATHS_API IndexedTriangle
00024 {
00025 public:
00027 inline_ IndexedTriangle() {}
00029 inline_ IndexedTriangle(udword r0, udword r1, udword r2) { mVRef[0]=r0; mVRef[1]=r1; mVRef[2]=r2; }
00031 inline_ IndexedTriangle(const IndexedTriangle& triangle)
00032 {
00033 mVRef[0] = triangle.mVRef[0];
00034 mVRef[1] = triangle.mVRef[1];
00035 mVRef[2] = triangle.mVRef[2];
00036 }
00038 inline_ ~IndexedTriangle() {}
00040 udword mVRef[3];
00041
00042
00043 void Flip();
00044 float Area(const Point* verts) const;
00045 float Perimeter(const Point* verts) const;
00046 float Compacity(const Point* verts) const;
00047 void Normal(const Point* verts, Point& normal) const;
00048 void DenormalizedNormal(const Point* verts, Point& normal) const;
00049 void Center(const Point* verts, Point& center) const;
00050 void CenteredNormal(const Point* verts, Point& normal) const;
00051 void RandomPoint(const Point* verts, Point& random) const;
00052 bool IsVisible(const Point* verts, const Point& source) const;
00053 bool BackfaceCulling(const Point* verts, const Point& source) const;
00054 float ComputeOcclusionPotential(const Point* verts, const Point& view) const;
00055 bool ReplaceVertex(udword oldref, udword newref);
00056 bool IsDegenerate() const;
00057 bool HasVertex(udword ref) const;
00058 bool HasVertex(udword ref, udword* index) const;
00059 ubyte FindEdge(udword vref0, udword vref1) const;
00060 udword OppositeVertex(udword vref0, udword vref1) const;
00061 inline_ udword OppositeVertex(ubyte edgenb) const { return mVRef[2-edgenb]; }
00062 void GetVRefs(ubyte edgenb, udword& vref0, udword& vref1, udword& vref2) const;
00063 float MinEdgeLength(const Point* verts) const;
00064 float MaxEdgeLength(const Point* verts) const;
00065 void ComputePoint(const Point* verts, float u, float v, Point& pt, udword* nearvtx=null) const;
00066 float Angle(const IndexedTriangle& tri, const Point* verts) const;
00067 inline_ Plane PlaneEquation(const Point* verts) const { return Plane(verts[mVRef[0]], verts[mVRef[1]], verts[mVRef[2]]); }
00068 bool Equal(const IndexedTriangle& tri) const;
00069 CubeIndex ComputeCubeIndex(const Point* verts) const;
00070 };
00071
00072 #endif // __ICEINDEXEDTRIANGLE_H__