simogl.collision
Class CollisionFinder

java.lang.Object
  extended by simogl.collision.CollisionFinder

public class CollisionFinder
extends java.lang.Object

This class can be used to find different kinds of collisions

Author:
Frank Bruns

Constructor Summary
CollisionFinder()
          Creates a new CollisionFinder object
 
Method Summary
 boolean collided(AbstractGameObject go1, AbstractGameObject go2)
          This method checks, if a collision between the two specified game objects has occured.
 boolean collided(AbstractMesh mesh1, AbstractMesh mesh2)
          This method checks, if a collision between the two specified meshes has occured.
 java.util.ArrayList<Triangle> collided(AbstractMesh mesh, Terrain terrain)
          This method checks, if a collision between the bottom center point of the mesh and the terrain has occured and returns the triangle(s) that has/have collided with the mesh.
 boolean collided(Point3D point, AbstractGameObject go)
          This method checks for collision between the specified point and the game object
 boolean collided(Point3D point, AbstractMesh mesh)
          This method checks for collision between the specified point and the mesh
 java.util.ArrayList<Triangle> collided(Point3D point, Terrain terrain)
          This method checks, if a collision between a point and the terrain has occured.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollisionFinder

public CollisionFinder()
Creates a new CollisionFinder object

Method Detail

collided

public boolean collided(AbstractMesh mesh1,
                        AbstractMesh mesh2)
This method checks, if a collision between the two specified meshes has occured.

Parameters:
mesh1 - first mesh
mesh2 - second mesh
Returns:
collision detected? --> true=yes, false=no

collided

public boolean collided(AbstractGameObject go1,
                        AbstractGameObject go2)
This method checks, if a collision between the two specified game objects has occured. This method is pretty similar to the one that checks two meshes for collision. The only difference between them is that you can specify game object instead of directly specifying mesh objects.

Parameters:
go1 - first game object
go2 - second game objet
Returns:
collision detected? --> true=yes, false=no

collided

public boolean collided(Point3D point,
                        AbstractMesh mesh)
This method checks for collision between the specified point and the mesh

Parameters:
point - point to check for collision with mesh
mesh - mesh to check for collision with point
Returns:
collision detected? --> true=yes, false=no

collided

public boolean collided(Point3D point,
                        AbstractGameObject go)
This method checks for collision between the specified point and the game object

Parameters:
point - point to check for collision with game object
go - game object to check for collision with point
Returns:
collision detected? --> true=yes, false=no

collided

public java.util.ArrayList<Triangle> collided(AbstractMesh mesh,
                                              Terrain terrain)
This method checks, if a collision between the bottom center point of the mesh and the terrain has occured and returns the triangle(s) that has/have collided with the mesh.

Parameters:
mesh - mesh, that could have been collided with the terrain
terrain - terrain to check collision with
Returns:
ArrayList with the triangles, that have collided with the bottom center point of the specified mesh

collided

public java.util.ArrayList<Triangle> collided(Point3D point,
                                              Terrain terrain)
This method checks, if a collision between a point and the terrain has occured. To be precisely, it finds the trangle(s) this point is located on and returns the involved triangle(s).

Parameters:
point - point to check collision with
terrain - terrain to check collision with
Returns:
triangle(s) the specified point is located on