Introduction
libGDX has several geometric classes for dealing with shapes, areas, and volumes. These include:
- * (sometimes written frustrum*)
A full explanation of these concepts is beyond the current scope, but the above links may provide a starting point for further understanding. What follows is an overview of their use and implementation in Libgdx.
Bounding Boxes (code)
Frustum (code) or with a Ray (code) using the Intersector (code) class.
Circles (code)
Rectangle (code) can be tested for using the Intersector (code) class.
Frustum (code)
A frustum is a four-sided pyramid with the top cut off. It can be used to describe the volume visible to a rectangular view into a space with a perspective projection such as the case with a 3D scene projected onto a 2D monitor.
bounding boxes (code) and Spheres (code) against the volume of the frustum to determine visibility of scene objects. This is known as “frustum culling,” a very common scene optimization technique.
Planes (code)
ray (code) or line segment can be tested for using the Intersector (code) class.
Polygons(code)
Intersector (code) class, assuming the polygons are convex.
Rays (code)
http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/collision/BoundingBox.html) (code), planes (code), spheres (code), and triangles by using the Intersector (code) class.
Rays are particularly useful in picking operations. Cameras can provide a ray describing the current mouse or touch point in a window projected out into the scene from the point of view of the camera.
Rectangles (code)
circles (code) by using the Intersector (code) class.
Segments (code)
circles (code), and planes(code) by using the Intersector (code) class. This class is merely for convenience in grouping end points as the above tests accept endpoints directly for parameters.
Spheres (code)
Frustum (code) as well as rays (code) by using the Intersector (code) class.
