public class BaseCollisionChecker
extends java.lang.Object
| Constructor and Description |
|---|
BaseCollisionChecker() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
checkAxisAlignedRectangleCollision(float pLeftA,
float pTopA,
float pRightA,
float pBottomA,
float pLeftB,
float pTopB,
float pRightB,
float pBottomB) |
static boolean |
checkAxisAlignedRectangleContains(float pLeft,
float pTop,
float pRight,
float pBottom,
float pX,
float pY) |
static int |
relativeCCW(float pX1,
float pY1,
float pX2,
float pY2,
float pPX,
float pPY)
Returns an indicator of where the specified point (PX, PY) lies with
respect to the line segment from (X1, Y1) to (X2, Y2).
|
public static boolean checkAxisAlignedRectangleCollision(float pLeftA,
float pTopA,
float pRightA,
float pBottomA,
float pLeftB,
float pTopB,
float pRightB,
float pBottomB)
public static boolean checkAxisAlignedRectangleContains(float pLeft,
float pTop,
float pRight,
float pBottom,
float pX,
float pY)
public static int relativeCCW(float pX1,
float pY1,
float pX2,
float pY2,
float pPX,
float pPY)
A return value of 1 indicates that the line segment must turn in the direction that takes the positive X axis towards the negative Y axis. In the default coordinate system used by Java 2D, this direction is counterclockwise.
A return value of -1 indicates that the line segment must turn in the direction that takes the positive X axis towards the positive Y axis. In the default coordinate system, this direction is clockwise.
A return value of 0 indicates that the point lies exactly on the line segment. Note that an indicator value of 0 is rare and not useful for determining colinearity because of floating point rounding issues.
If the point is colinear with the line segment, but not between the endpoints, then the value will be -1 if the point lies "beyond (X1, Y1)" or 1 if the point lies "beyond (X2, Y2)".
pX1 - , Y1 the coordinates of the beginning of the specified
line segmentpX2 - , Y2 the coordinates of the end of the specified line
segmentpPX - , PY the coordinates of the specified point to be
compared with the specified line segment