game-engine/src/main/java/com/jzy/game/engine/math/Intersector.java
/**
	 * Checks whether the given point is in the polygon.
	 * 
	 * @param polygon
	 *            The polygon vertices passed as an array
	 * @param point
	 *            The point
	 * @return true if the point is in the polygon
	 */
Checks whether the given point is in the polygon.

@param polygon
The polygon vertices passed as an array
@param point
The point
@return true if the point is in the polygon
Checks whether the given point is in the polygon . @param polygon The polygon vertices passed as an array @param point The point @return true if the point is in the polygon
public static boolean isPointInPolygon(List<Vector2> polygon, Vector2 point) {
		Vector2 lastVertice = polygon.get(polygon.size() - 1);
		boolean oddNodes = false;
		for (int i = 0; i < polygon.size(); i++) {
			Vector2 vertice = polygon.get(i);
			if ((vertice.y < point.y && lastVertice.y >= point.y)
					|| (lastVertice.y < point.y && vertice.y >= point.y)) {
				if (vertice.x
						+ (point.y - vertice.y) / (lastVertice.y - vertice.y) * (lastVertice.x - vertice.x) < point.x) {
					oddNodes = !oddNodes;
				}
			}
			lastVertice = vertice;
		}
		return oddNodes;
	}
public static boolean isPointInPolygon ( List < Vector2 > polygon , Vector2 point ) { Vector2 lastVertice = polygon . get ( polygon . size ( ) - 1 ) ; boolean oddNodes = false ; for ( int i = 0 ; i < polygon . size ( ) ; i ++ ) { Vector2 vertice = polygon . get ( i ) ; if ( ( vertice . y < point . y && lastVertice . y >= point . y ) || ( lastVertice . y < point . y && vertice . y >= point . y ) ) { if ( vertice . x + ( point . y - vertice . y ) / ( lastVertice . y - vertice . y ) * ( lastVertice . x - vertice . x ) < point . x ) { oddNodes = ! oddNodes ; } } lastVertice = vertice ; } return oddNodes ; }
Checks whether the given point is in the polygon.
Checks whether the given point is in the polygon .