/***************************************************************************
 *   Copyright (C) 2006 by Harish Kukreja                                  *
 *   harish.kukreja@gmail.com                                              *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

//
// C++ Interface: collision
//
// Description: Collision detection & reaction functions and objects.
//
//
// Author: Harish Kukreja <harish.kukreja@gmail.com>, (C) 2006
//
// Copyright: See COPYING file that comes with this distribution
//
//


#ifndef _PHYSIKS_COLLISION_H_
#define _PHYSIKS_COLLISION_H_

#include "objects.h"

namespace Physiks {

  namespace Collisions {

    using Physiks::PhysicalObject;
    using Physiks::Sphere;
    using Physiks::Plane;

    namespace Detection {

      /** Check for a collision between the given point and sphere. */
      bool point_sphere(const PhysicalObject &obj, const Sphere &sph);

      /** Check for a collision between the given point and plane. */
      bool point_plane(const PhysicalObject &obj, const Plane &plane);

      /** Check for a collision between two spheres. */
      bool sphere_sphere(const Sphere &sph1, const Sphere &sph2);

      /** Check for a collision between the given sphere and plane. */
      bool sphere_plane(const Sphere &sphere, const Plane &plane);

    }

    namespace Reaction {

      /** Each of the following functions adjusts the force vectors of its
       * parameters based on the relevant collision information (e.x. positions
       * of objects relative to each other, elasticity of spheres, etc.)  */
      void point_sphere(PhysicalObject &obj, Sphere &sph);
      void point_plane(PhysicalObject &obj, Plane &plane);
      void sphere_sphere(Sphere &sph1, Sphere &sph2);
      void sphere_plane(Sphere &sphere, Plane &plane);
    }

  }   // End of namespace Collisions
}   // End of namespace Physiks

#endif
