jglphys
Class JGL_Collision

java.lang.Object
  extended by jglphys.JGL_Collision

public final class JGL_Collision
extends java.lang.Object

Static class gathering collision operations.

Author:
Nicolas Devere

Constructor Summary
JGL_Collision()
           
 
Method Summary
static boolean slideSphereBsp(JGL_3DVector sphere1Center, JGL_3DVector sphere2Center, float sphereOffset, JGL_3DBsp bsp, boolean test)
          Tests if the specified moving sphere crosses the specified BSP tree.
static boolean testTrianglePoint(JGL_3DTriangle triangle, JGL_3DVector intersection, float offset)
          Computes if the intersection point is nearer from the triangle than the offset.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JGL_Collision

public JGL_Collision()
Method Detail

slideSphereBsp

public static boolean slideSphereBsp(JGL_3DVector sphere1Center,
                                     JGL_3DVector sphere2Center,
                                     float sphereOffset,
                                     JGL_3DBsp bsp,
                                     boolean test)
Tests if the specified moving sphere crosses the specified BSP tree. if true, the sphere is slid against the crossed faces.

Parameters:
sphere1Center - : the sphere's first position
sphere2Center - : the sphere's second position
sphereOffset - : the sphere offset
bsp - : the BSP to test
test - : recursive variable, set it to false for a good use of this method
Returns:
true if collision, false otherwise

testTrianglePoint

public static boolean testTrianglePoint(JGL_3DTriangle triangle,
                                        JGL_3DVector intersection,
                                        float offset)
Computes if the intersection point is nearer from the triangle than the offset.

Parameters:
triangle - : the triangle
intersection - : the intersection point to test
offset - : the minimum distance
Returns:
true if the point is nearer than the offset, false otherwise