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
IceTriangle.h
Go to the documentation of this file.
1 
8 
11 // Include Guard
12 #ifndef __ICETRIANGLE_H__
13 #define __ICETRIANGLE_H__
14 
15  // Forward declarations
16  class Moment;
17 
18  // Partitioning values
19  enum PartVal
20  {
25 
26  TRI_FORCEDWORD = 0x7fffffff
27  };
28 
29  // A triangle class.
31  {
32  public:
36  inline_ Triangle(const Point& p0, const Point& p1, const Point& p2) { mVerts[0]=p0; mVerts[1]=p1; mVerts[2]=p2; }
38  inline_ Triangle(const Triangle& triangle)
39  {
40  mVerts[0] = triangle.mVerts[0];
41  mVerts[1] = triangle.mVerts[1];
42  mVerts[2] = triangle.mVerts[2];
43  }
47  Point mVerts[3];
48 
49  // Methods
50  void Flip();
51  float Area() const;
52  float Perimeter() const;
53  float Compacity() const;
54  void Normal(Point& normal) const;
55  void DenormalizedNormal(Point& normal) const;
56  void Center(Point& center) const;
57  inline_ Plane PlaneEquation() const { return Plane(mVerts[0], mVerts[1], mVerts[2]); }
58 
59  PartVal TestAgainstPlane(const Plane& plane, float epsilon) const;
60 // float Distance(Point& cp, Point& cq, Tri& tri);
61  void ComputeMoment(Moment& m);
62  float MinEdgeLength() const;
63  float MaxEdgeLength() const;
64  void ComputePoint(float u, float v, Point& pt, udword* nearvtx=null) const;
65  void Inflate(float fat_coeff, bool constant_border);
66  };
67 
68 #endif // __ICETRIANGLE_H__