//------------------------------------------------------------------------------
// 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 SEGMENT_DISTANCE_H_
#define SEGMENT_DISTANCE_H_

namespace Lamp{

class Segment;
class Sphere;
class Triangle;

//------------------------------------------------------------------------------
/**
 * セグメント距離
 */
class SegmentDistance{
public:
	//--------------------------------------------------------------------------
	// 点
	//--------------------------------------------------------------------------
	/**
	 * 点距離の二乗
	 * @param segment セグメント
	 * @param point 点
	 * @return 距離の二乗
	 */
	static float squaredDistance(const Segment& segment, const Vector3& point);

	//--------------------------------------------------------------------------
	// セグメント
	//--------------------------------------------------------------------------
	/**
	 * 距離の二乗
	 * @param segment0 セグメント
	 * @param segment1 セグメント
	 * @return 距離の二乗
	 */
	static float squaredDistance(
		const Segment& segment0, const Segment& segment1);

	//--------------------------------------------------------------------------
	// 球
	//--------------------------------------------------------------------------
	/**
	 * 球距離の二乗
	 * @param segment セグメント
	 * @param sphere 球
	 * @return 距離の二乗
	 */
	static float squaredDistance(const Segment& segment, const Sphere& sphere);

	//--------------------------------------------------------------------------
	// 三角
	//--------------------------------------------------------------------------
	/**
	 * 三角距離の二乗
	 * @param segment セグメント
	 * @param triangle 三角
	 * @return 距離の二乗
	 */
	static float squaredDistance(
		const Segment& segment, const Triangle& triangle);

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

};

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