code: @Pure
  	private static boolean containsTrianglePoint(
  			int i0, int i1, double[] v, double[] u1, double[] u2, double[] u3) {
  		// is T1 completly inside T2?
  		// check if V0 is inside tri(U0,U1,U2)
  		double a  = u2[i1] - u1[i1];
  		double b  = -(u2[i0] - u1[i0]);
  		double c  = -a * u1[i0] - b * u1[i1];
  		double d0 = a * v[i0] + b * v[i1] + c;
  
  		a         = u3[i1] - u2[i1];
  		b         = -(u3[i0] - u2[i0]);
  		c         = -a * u2[i0] - b * u2[i1];
  		double d1 = a * v[i0] + b * v[i1] + c;
  
  		a         = u1[i1] - u2[i1];
  		b         = -(u1[i0] - u3[i0]);
  		c         = -a * u3[i0] - b * u3[i1];
  		double d2 = a * v[i0] + b * v[i1] + c;
  
  		return ((d0*d1>0.)&&(d0*d2>0.0));
  	}
docs: Replies if a point is inside a triangle.