|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.badlogic.gdx.math.Intersector
public final class Intersector
Class offering various static methods for intersection testing between different geometric objects.
Constructor Summary | |
---|---|
Intersector()
|
Method Summary | |
---|---|
static float |
distanceLinePoint(Vector2 start,
Vector2 end,
Vector2 point)
Returns the distance between the given line segment and point. |
static float |
getLowestPositiveRoot(float a,
float b,
float c)
Returns the lowest positive root of the quadric equation given by a* x * x + b * x + c = 0. |
static boolean |
intersectLines(Vector2 p1,
Vector2 p2,
Vector2 p3,
Vector2 p4,
Vector2 intersection)
Intersects the two lines and returns the intersection point in intersection. |
static boolean |
intersectRayBoundsFast(Ray ray,
BoundingBox box)
Quick check wheter the given Ray and BoundingBox intersect. |
static boolean |
intersectRayPlane(Ray ray,
Plane plane,
Vector3 intersection)
Intersects a Ray and a Plane . |
static boolean |
intersectRaySphere(Ray ray,
Vector3 center,
float radius,
Vector3 intersection)
Intersects a Ray and a sphere, returning the intersection point in intersection. |
static boolean |
intersectRayTriangle(Ray ray,
Vector3 t1,
Vector3 t2,
Vector3 t3,
Vector3 intersection)
Intersect a Ray and a triangle, returning the intersection point in intersection. |
static boolean |
intersectRayTriangles(Ray ray,
float[] vertices,
short[] indices,
int vertexSize,
Vector3 intersection)
Intersects the given ray with list of triangles. |
static boolean |
intersectRayTriangles(Ray ray,
float[] triangles,
Vector3 intersection)
Intersects the given ray with list of triangles. |
static boolean |
intersectRayTriangles(Ray ray,
java.util.List<Vector3> triangles,
Vector3 intersection)
Intersects the given ray with list of triangles. |
static boolean |
intersectRectangles(Rectangle a,
Rectangle b)
Returns wheter the two rectangles intersect |
static boolean |
intersectSegmentCircle(Vector2 start,
Vector2 end,
Vector2 center,
float squareRadius)
Returns wheter the given line segment intersects the given circle. |
static float |
intersectSegmentCircleDisplace(Vector2 start,
Vector2 end,
Vector2 point,
float radius,
Vector2 displacement)
Checks wheter the line segment and the circle intersect and returns by how much and in what direction the line has to move away from the circle to not intersect. |
static boolean |
intersectSegmentPlane(Vector3 start,
Vector3 end,
Plane plane,
Vector3 intersection)
|
static boolean |
intersectSegments(Vector2 p1,
Vector2 p2,
Vector2 p3,
Vector2 p4,
Vector2 intersection)
Intersects the two line segments and returns the intersection point in intersection. |
static boolean |
isPointInPolygon(java.util.List<Vector2> polygon,
Vector2 point)
Checks wheter the given point is in the polygon. |
static boolean |
isPointInTriangle(Vector3 point,
Vector3 t1,
Vector3 t2,
Vector3 t3)
Returns whether the given point is inside the triangle. |
static boolean |
overlapCircleRectangle(Circle c,
Rectangle r)
|
static boolean |
overlapCircles(Circle c1,
Circle c2)
|
static boolean |
overlapRectangles(Rectangle r1,
Rectangle r2)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Intersector()
Method Detail |
---|
public static float getLowestPositiveRoot(float a, float b, float c)
a
- the first coefficient of the quadric equationb
- the second coefficient of the quadric equationc
- the third coefficient of the quadric equation
public static boolean isPointInTriangle(Vector3 point, Vector3 t1, Vector3 t2, Vector3 t3)
point
- the pointt1
- the first vertex of the trianglet2
- the second vertex of the trianglet3
- the third vertex of the triangle
public static boolean intersectSegmentPlane(Vector3 start, Vector3 end, Plane plane, Vector3 intersection)
public static boolean isPointInPolygon(java.util.List<Vector2> polygon, Vector2 point)
Vector3
s are used.
polygon
- The polygon verticespoint
- The point
public static float distanceLinePoint(Vector2 start, Vector2 end, Vector2 point)
start
- The line start pointend
- The line end pointpoint
- The point
public static boolean intersectSegmentCircle(Vector2 start, Vector2 end, Vector2 center, float squareRadius)
start
- The start point of the line segmentend
- The end point of the line segmentcenter
- The center of the circlesquareRadius
- The squared radius of the circle
public static float intersectSegmentCircleDisplace(Vector2 start, Vector2 end, Vector2 point, float radius, Vector2 displacement)
start
- The line segment starting pointend
- The line segment end pointpoint
- The center of the circleradius
- The radius of the circledisplacement
- The displacement vector set by the method having unit length
public static boolean intersectRayPlane(Ray ray, Plane plane, Vector3 intersection)
Ray
and a Plane
. The intersection point is stored in intersection in case an intersection is
present.
ray
- The rayplane
- The planeintersection
- The vector the intersection point is written to (optional)
public static boolean intersectRayTriangle(Ray ray, Vector3 t1, Vector3 t2, Vector3 t3, Vector3 intersection)
Ray
and a triangle, returning the intersection point in intersection.
ray
- The rayt1
- The first vertex of the trianglet2
- The second vertex of the trianglet3
- The third vertex of the triangleintersection
- The intersection point (optional)
public static boolean intersectRaySphere(Ray ray, Vector3 center, float radius, Vector3 intersection)
Ray
and a sphere, returning the intersection point in intersection.
ray
- The raycenter
- The center of the sphereradius
- The radius of the sphereintersection
- The intersection point (optional)
public static boolean intersectRayBoundsFast(Ray ray, BoundingBox box)
Ray
and BoundingBox
intersect.
ray
- The raybox
- The bounding box
public static boolean intersectRayTriangles(Ray ray, float[] triangles, Vector3 intersection)
ray
- The raytriangles
- The triangles, each successive 3 elements from a vertexintersection
- The nearest intersection point (optional)
public static boolean intersectRayTriangles(Ray ray, float[] vertices, short[] indices, int vertexSize, Vector3 intersection)
ray
- The rayvertices
- the verticesindices
- the indices, each successive 3 shorts index the 3 vertices of a trianglevertexSize
- the size of a vertex in floatsintersection
- The nearest intersection point (optional)
public static boolean intersectRayTriangles(Ray ray, java.util.List<Vector3> triangles, Vector3 intersection)
ray
- The raytriangles
- The trianglesintersection
- The nearest intersection point (optional)
public static boolean intersectRectangles(Rectangle a, Rectangle b)
a
- The first rectangleb
- The second rectangle
public static boolean intersectLines(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, Vector2 intersection)
p1
- The first point of the first linep2
- The second point of the first linep3
- The first point of the second linep4
- The second point of the second lineintersection
- The intersection point
public static boolean intersectSegments(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, Vector2 intersection)
p1
- The first point of the first line segmentp2
- The second point of the first line segmentp3
- The first point of the second line segmentp4
- The second point of the second line segmentintersection
- The intersection point (optional)
public static boolean overlapCircles(Circle c1, Circle c2)
public static boolean overlapRectangles(Rectangle r1, Rectangle r2)
public static boolean overlapCircleRectangle(Circle c, Rectangle r)
|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |