Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IceIndexedTriangle.h
Go to the documentation of this file.
1 
8 
11 // Include Guard
12 #ifndef __ICEINDEXEDTRIANGLE_H__
13 #define __ICEINDEXEDTRIANGLE_H__
14 
15  // An indexed triangle class.
17  {
18  public:
22  inline_ IndexedTriangle(udword r0, udword r1, udword r2) { mVRef[0]=r0; mVRef[1]=r1; mVRef[2]=r2; }
25  {
26  mVRef[0] = triangle.mVRef[0];
27  mVRef[1] = triangle.mVRef[1];
28  mVRef[2] = triangle.mVRef[2];
29  }
34 
35  // Methods
36  void Flip();
37  float Area(const Point* verts) const;
38  float Perimeter(const Point* verts) const;
39  float Compacity(const Point* verts) const;
40  void Normal(const Point* verts, Point& normal) const;
41  void DenormalizedNormal(const Point* verts, Point& normal) const;
42  void Center(const Point* verts, Point& center) const;
43  void CenteredNormal(const Point* verts, Point& normal) const;
44  void RandomPoint(const Point* verts, Point& random) const;
45  bool IsVisible(const Point* verts, const Point& source) const;
46  bool BackfaceCulling(const Point* verts, const Point& source) const;
47  float ComputeOcclusionPotential(const Point* verts, const Point& view) const;
48  bool ReplaceVertex(udword oldref, udword newref);
49  bool IsDegenerate() const;
50  bool HasVertex(udword ref) const;
51  bool HasVertex(udword ref, udword* index) const;
52  ubyte FindEdge(udword vref0, udword vref1) const;
53  udword OppositeVertex(udword vref0, udword vref1) const;
54  inline_ udword OppositeVertex(ubyte edgenb) const { return mVRef[2-edgenb]; }
55  void GetVRefs(ubyte edgenb, udword& vref0, udword& vref1, udword& vref2) const;
56  float MinEdgeLength(const Point* verts) const;
57  float MaxEdgeLength(const Point* verts) const;
58  void ComputePoint(const Point* verts, float u, float v, Point& pt, udword* nearvtx=null) const;
59  float Angle(const IndexedTriangle& tri, const Point* verts) const;
60  inline_ Plane PlaneEquation(const Point* verts) const { return Plane(verts[mVRef[0]], verts[mVRef[1]], verts[mVRef[2]]); }
61  bool Equal(const IndexedTriangle& tri) const;
62  };
63 
64 #endif // __ICEINDEXEDTRIANGLE_H__