28 Point TriEdge0 = vert1 - vert0;
29 Point TriEdge1 = vert2 - vert0;
33 float fA01 = TriEdge0 | TriEdge1;
35 float fB0 = kDiff | TriEdge0;
36 float fB1 = kDiff | TriEdge1;
38 float fDet = fabsf(fA00*fA11 - fA01*fA01);
39 float u = fA01*fB1-fA11*fB0;
40 float v = fA01*fB0-fA00*fB1;
52 if(-fB0>=fA00) { SqrDist = fA00+2.0f*fB0+fC; }
53 else { u = -fB0/fA00; SqrDist = fB0*u+fC; }
58 if(fB1>=0.0
f) { SqrDist = fC; }
59 else if(-fB1>=fA11) { SqrDist = fA11+2.0f*fB1+fC; }
60 else { v = -fB1/fA11; SqrDist = fB1*v+fC; }
66 if(fB1>=0.0
f) { SqrDist = fC; }
67 else if(-fB1>=fA11) { SqrDist = fA11+2.0f*fB1+fC; }
68 else { v = -fB1/fA11; SqrDist = fB1*v+fC; }
74 if(fB0>=0.0
f) { SqrDist = fC; }
75 else if(-fB0>=fA00) { SqrDist = fA00+2.0f*fB0+fC; }
76 else { u = -fB0/fA00; SqrDist = fB0*u+fC; }
89 float fInvDet = 1.0f/fDet;
92 SqrDist = u*(fA00*u+fA01*v+2.0f*fB0) + v*(fA01*u+fA11*v+2.0
f*fB1)+fC;
98 float fTmp0, fTmp1, fNumer, fDenom;
106 fNumer = fTmp1 - fTmp0;
107 fDenom = fA00-2.0f*fA01+fA11;
112 SqrDist = fA00+2.0f*fB0+fC;
118 SqrDist = u*(fA00*u+fA01*v+2.0f*fB0) + v*(fA01*u+fA11*v+2.0
f*fB1)+fC;
124 if(fTmp1 <= 0.0
f) { SqrDist = fA11+2.0f*fB1+fC; }
125 else if(fB1 >= 0.0
f) { SqrDist = fC; }
126 else { v = -fB1/fA11; SqrDist = fB1*v+fC; }
135 fNumer = fTmp1 - fTmp0;
136 fDenom = fA00-2.0f*fA01+fA11;
141 SqrDist = fA11+2.0f*fB1+fC;
147 SqrDist = u*(fA00*u+fA01*v+2.0f*fB0) + v*(fA01*u+fA11*v+2.0
f*fB1)+fC;
153 if(fTmp1 <= 0.0
f) { SqrDist = fA00+2.0f*fB0+fC; }
154 else if(fB0 >= 0.0
f) { SqrDist = fC; }
155 else { u = -fB0/fA00; SqrDist = fB0*u+fC; }
160 fNumer = fA11 + fB1 - fA01 - fB0;
165 SqrDist = fA11+2.0f*fB1+fC;
169 fDenom = fA00-2.0f*fA01+fA11;
174 SqrDist = fA00+2.0f*fB0+fC;
180 SqrDist = u*(fA00*u+fA01*v+2.0f*fB0) + v*(fA01*u+fA11*v+2.0
f*fB1)+fC;