//------------------------------------------------------------------------------
// Lamp : Open source game middleware
// Copyright (C) 2004  Junpei Ohtani ( Email : junpee@users.sourceforge.jp )
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library 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
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//------------------------------------------------------------------------------

/** @file
 * 球交差ヘッダ
 * @author Junpee
 */

#ifndef SPHERE_INTERSECTION_H_
#define SPHERE_INTERSECTION_H_

namespace Lamp{

class Intersection;
class Sphere;
class Triangle;

//------------------------------------------------------------------------------
/**
 * 球交差
 */
class SphereIntersection{
public:
	//--------------------------------------------------------------------------
	// 点
	//--------------------------------------------------------------------------
	/**
	 * 点交差
	 * @param sphere 球
	 * @param point 点
	 * @return 交差していればtrue
	 */
	static bool intersect(const Sphere& sphere, const Vector3& point);

	//--------------------------------------------------------------------------
	// 球
	//--------------------------------------------------------------------------
	/**
	 * 球交差
	 * @param sphere0 球
	 * @param sphere1 球
	 * @return 交差していればtrue
	 */
	static bool intersect(const Sphere& sphere0, const Sphere& sphere1);

	/**
	 * 球交差
	 * @param intersecion 交差、返り値がtrueなら設定されている
	 * @param sphere0 球
	 * @param sphere1 球
	 * @return 交差していればtrue
	 */
	static bool intersect(Intersection* intersection,
		const Sphere& sphere0, const Sphere& sphere1);

	//--------------------------------------------------------------------------
	// 三角
	//--------------------------------------------------------------------------
	/**
	 * 三角交差
	 * @param sphere 球
	 * @param triangle 三角
	 * @return 交差していればtrue
	 */
	static bool intersect(const Sphere& sphere, const Triangle& triangle);

	/**
	 * 三角交差
	 * @param intersecion 交差、返り値がtrueなら設定されている
	 * @param sphere 球
	 * @param triangle 三角
	 * @return 交差していればtrue
	 */
	static bool intersect(Intersection* intersection,
		const Sphere& sphere, const Triangle& triangle);

private:
	//--------------------------------------------------------------------------
	// コンストラクタの隠蔽
	SphereIntersection();

};

//------------------------------------------------------------------------------
} // End of namespace Lamp
#endif // End of SPHERE_INTERSECTION_H_
//------------------------------------------------------------------------------
