why not use Sign? didnt really look at the math behind that function but from my engine, cba converting...
Code:
public float Sign(PointD PointD_A, PointD PointD_B, PointD PointD_C) {
return (PointD_A.X() - PointD_C.X()) * (PointD_B.Y() - PointD_C.Y())
- (PointD_B.X() - PointD_C.X()) * (PointD_A.Y() - PointD_C.Y());
}
public boolean PointInTri(PointD PointD_P, PointD PointD_A,
PointD PointD_B, PointD PointD_C) {
boolean[] boolArrTemp = new boolean[3];
boolArrTemp[0] = (Sign(PointD_P, PointD_A, PointD_B) <= 0.0F);
boolArrTemp[1] = (Sign(PointD_P, PointD_B, PointD_C) <= 0.0F);
boolArrTemp[2] = (Sign(PointD_P, PointD_C, PointD_A) <= 0.0F);
return (boolArrTemp[0] == boolArrTemp[1])
&& (boolArrTemp[1] == boolArrTemp[2]);
}