Go to the documentation of this file.00001
00002
00008
00009
00011
00012 #ifndef __ICETRIANGLE_H__
00013 #define __ICETRIANGLE_H__
00014
00015
00016 class Moment;
00017
00018
00019 enum PartVal
00020 {
00021 TRI_MINUS_SPACE = 0,
00022 TRI_PLUS_SPACE = 1,
00023 TRI_INTERSECT = 2,
00024 TRI_ON_PLANE = 3,
00025
00026 TRI_FORCEDWORD = 0x7fffffff
00027 };
00028
00029
00030 class ICEMATHS_API Triangle
00031 {
00032 public:
00034 inline_ Triangle() {}
00036 inline_ Triangle(const Point& p0, const Point& p1, const Point& p2) { mVerts[0]=p0; mVerts[1]=p1; mVerts[2]=p2; }
00038 inline_ Triangle(const Triangle& triangle)
00039 {
00040 mVerts[0] = triangle.mVerts[0];
00041 mVerts[1] = triangle.mVerts[1];
00042 mVerts[2] = triangle.mVerts[2];
00043 }
00045 inline_ ~Triangle() {}
00047 Point mVerts[3];
00048
00049
00050 void Flip();
00051 float Area() const;
00052 float Perimeter() const;
00053 float Compacity() const;
00054 void Normal(Point& normal) const;
00055 void DenormalizedNormal(Point& normal) const;
00056 void Center(Point& center) const;
00057 inline_ Plane PlaneEquation() const { return Plane(mVerts[0], mVerts[1], mVerts[2]); }
00058
00059 PartVal TestAgainstPlane(const Plane& plane, float epsilon) const;
00060
00061 void ComputeMoment(Moment& m);
00062 float MinEdgeLength() const;
00063 float MaxEdgeLength() const;
00064 void ComputePoint(float u, float v, Point& pt, udword* nearvtx=null) const;
00065 void Inflate(float fat_coeff, bool constant_border);
00066 };
00067
00068 #endif // __ICETRIANGLE_H__