35 return Dist > epsilon ? 1 : Dist < -epsilon ? -1 : 0;
45 Point Tmp = mVerts[1];
46 mVerts[1] = mVerts[2];
58 const Point& p0 = mVerts[0];
59 const Point& p1 = mVerts[1];
60 const Point& p2 = mVerts[2];
61 return ((p0 - p1)^(p0 - p2)).
Magnitude() * 0.5f;
72 const Point& p0 = mVerts[0];
73 const Point& p1 = mVerts[1];
74 const Point& p2 = mVerts[2];
88 float P = Perimeter();
89 if(P==0.0
f)
return 0.0f;
90 return (4.0
f*
PI*Area()/(P*P));
101 const Point& p0 = mVerts[0];
102 const Point& p1 = mVerts[1];
103 const Point& p2 = mVerts[2];
104 normal = ((p0 - p1)^(p0 - p2)).Normalize();
115 const Point& p0 = mVerts[0];
116 const Point& p1 = mVerts[1];
117 const Point& p2 = mVerts[2];
118 normal = ((p0 - p1)^(p0 - p2));
129 const Point& p0 = mVerts[0];
130 const Point& p1 = mVerts[1];
131 const Point& p2 = mVerts[2];
132 center = (p0 + p1 + p2)*
INV3;
137 bool Pos =
false, Neg =
false;
145 if (Side < 0) Neg =
true;
146 else if (Side > 0) Pos =
true;
216 float Length01 = mVerts[0].Distance(mVerts[1]);
217 float Length02 = mVerts[0].Distance(mVerts[2]);
218 float Length12 = mVerts[1].Distance(mVerts[2]);
219 if(Length01 < Min) Min = Length01;
220 if(Length02 < Min) Min = Length02;
221 if(Length12 < Min) Min = Length12;
234 float Length01 = mVerts[0].Distance(mVerts[1]);
235 float Length02 = mVerts[0].Distance(mVerts[2]);
236 float Length12 = mVerts[1].Distance(mVerts[2]);
237 if(Length01 > Max) Max = Length01;
238 if(Length02 > Max) Max = Length02;
239 if(Length12 > Max) Max = Length12;
254 pt = (1.0f - u - v)*mVerts[0] + u*mVerts[1] + v*mVerts[2];
260 Point d(mVerts[0].SquareDistance(pt),
261 mVerts[1].SquareDistance(pt),
262 mVerts[2].SquareDistance(pt));
272 Point TriangleCenter;
273 Center(TriangleCenter);
280 Point v = mVerts[
i] - TriangleCenter;
284 mVerts[
i] += v * fat_coeff;
void ComputePoint(float u, float v, Point &pt, udword *nearvtx=null) const
signed int sdword
sizeof(sdword) must be 4
void DenormalizedNormal(Point &normal) const
inline_ PointComponent SmallestAxis() const
Returns smallest axis.
void Inflate(float fat_coeff, bool constant_border)
inline_ float Magnitude() const
Computes magnitude.
PartVal TestAgainstPlane(const Plane &plane, float epsilon) const
void Center(Point ¢er) const
inline_ float Distance(const Point &p) const
unsigned int udword
sizeof(udword) must be 4
Triangle and plane are coplanar.
float MinEdgeLength() const
Triangle intersects plane.
#define MAX_FLOAT
max possible float value
Triangle is in the negative space.
void Normal(Point &normal) const
Triangle is in the positive space.
float MaxEdgeLength() const
static sdword VPlaneSideEps(const Point &v, const Plane &plane, float epsilon)
inline_ Point & Normalize()
Normalizes the vector.
#define MIN_FLOAT
min possible loat value
inline_ float Distance(const Point &b) const
Computes distance to another point.