game-engine/src/main/java/com/jzy/game/engine/math/Intersector.java
/** Returns true if the given point is inside the triangle. */
Returns true if the given point is inside the triangle.
Returns true if the given point is inside the triangle .
public static boolean isPointInTriangle(Vector2 p, Vector2 a, Vector2 b, Vector2 c) {
		float px1 = p.x - a.x;
		float py1 = p.y - a.y;
		boolean side12 = (b.x - a.x) * py1 - (b.y - a.y) * px1 > 0;
		if ((c.x - a.x) * py1 - (c.y - a.y) * px1 > 0 == side12)
			return false;
		if ((c.x - b.x) * (p.y - b.y) - (c.y - b.y) * (p.x - b.x) > 0 != side12)
			return false;
		return true;
	}
public static boolean isPointInTriangle ( Vector2 p , Vector2 a , Vector2 b , Vector2 c ) { float px1 = p . x - a . x ; float py1 = p . y - a . y ; boolean side12 = ( b . x - a . x ) * py1 - ( b . y - a . y ) * px1 > 0 ; if ( ( c . x - a . x ) * py1 - ( c . y - a . y ) * px1 > 0 == side12 ) return false ; if ( ( c . x - b . x ) * ( p . y - b . y ) - ( c . y - b . y ) * ( p . x - b . x ) > 0 != side12 ) return false ; return true ; }
Returns true if the given point is inside the triangle.
Returns true if the given point is inside the triangle .