00001 //------------------------------------------------------------------------------ 00002 // Lamp : Open source game middleware 00003 // Copyright (C) 2004 Junpei Ohtani ( Email : junpee@users.sourceforge.jp ) 00004 // 00005 // This library is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU Lesser General Public 00007 // License as published by the Free Software Foundation; either 00008 // version 2.1 of the License, or (at your option) any later version. 00009 // 00010 // This library is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 // Lesser General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public 00016 // License along with this library; if not, write to the Free Software 00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 //------------------------------------------------------------------------------ 00019 00020 /** @file 00021 * カプセル距離ヘッダ 00022 * @author Junpee 00023 */ 00024 00025 #ifndef CAPSULE_DISTANCE_H_ 00026 #define CAPSULE_DISTANCE_H_ 00027 00028 namespace Lamp{ 00029 00030 class Capsule; 00031 class Cone; 00032 class Line; 00033 class OrientedBox; 00034 class Plane; 00035 class Ray; 00036 class Segment; 00037 class Sphere; 00038 class Triangle; 00039 00040 //------------------------------------------------------------------------------ 00041 /** 00042 * カプセル距離 00043 */ 00044 class CapsuleDistance{ 00045 public: 00046 //-------------------------------------------------------------------------- 00047 // 点 00048 //-------------------------------------------------------------------------- 00049 /** 00050 * 点距離の二乗 00051 * @param capsule カプセル 00052 * @param point 点 00053 * @return 距離の二乗 00054 */ 00055 static float squaredDistance(const Capsule& capsule, const Vector3& point); 00056 00057 //-------------------------------------------------------------------------- 00058 // カプセル 00059 //-------------------------------------------------------------------------- 00060 /** 00061 * カプセル距離の二乗 00062 * @param capsule0 カプセル 00063 * @param capsule1 カプセル 00064 * @return 距離の二乗 00065 */ 00066 static float squaredDistance( 00067 const Capsule& capsule0, const Capsule& capsule1); 00068 00069 //-------------------------------------------------------------------------- 00070 // コーン 00071 //-------------------------------------------------------------------------- 00072 /** 00073 * コーン距離の二乗 00074 * @param capsule カプセル 00075 * @param cone コーン 00076 * @return 距離の二乗 00077 */ 00078 static float squaredDistance(const Capsule& capsule, const Cone& cone); 00079 00080 //-------------------------------------------------------------------------- 00081 // ライン 00082 //-------------------------------------------------------------------------- 00083 /** 00084 * ライン距離の二乗 00085 * @param capsule カプセル 00086 * @param line ライン 00087 * @return 距離の二乗 00088 */ 00089 static float squaredDistance(const Capsule& capsule, const Line& line); 00090 00091 //-------------------------------------------------------------------------- 00092 // 指向性ボックス 00093 //-------------------------------------------------------------------------- 00094 /** 00095 * 指向性ボックス距離の二乗 00096 * @param capsule カプセル 00097 * @param ob 指向性ボックス 00098 * @return 距離の二乗 00099 */ 00100 static float squaredDistance(const Capsule& capsule, const OrientedBox& ob); 00101 00102 //-------------------------------------------------------------------------- 00103 // 平面 00104 //-------------------------------------------------------------------------- 00105 /** 00106 * 平面距離 00107 * @param capsule カプセル 00108 * @param plane 平面 00109 * @return 距離 00110 */ 00111 static float distance(const Capsule& capsule, const Plane& plane); 00112 00113 //-------------------------------------------------------------------------- 00114 // レイ 00115 //-------------------------------------------------------------------------- 00116 /** 00117 * レイ距離の二乗 00118 * @param capsule カプセル 00119 * @param ray レイ 00120 * @return 距離の二乗 00121 */ 00122 static float squaredDistance(const Capsule& capsule, const Ray& ray); 00123 00124 //-------------------------------------------------------------------------- 00125 // セグメント 00126 //-------------------------------------------------------------------------- 00127 /** 00128 * セグメント距離の二乗 00129 * @param capsule カプセル 00130 * @param segment セグメント 00131 * @return 距離の二乗 00132 */ 00133 static float squaredDistance( 00134 const Capsule& capsule, const Segment& segment); 00135 00136 //-------------------------------------------------------------------------- 00137 // 球 00138 //-------------------------------------------------------------------------- 00139 /** 00140 * 球距離の二乗 00141 * @param capsule カプセル 00142 * @param sphere 球 00143 * @return 距離の二乗 00144 */ 00145 static float squaredDistance( 00146 const Capsule& capsule, const Sphere& sphere); 00147 00148 //-------------------------------------------------------------------------- 00149 // 三角 00150 //-------------------------------------------------------------------------- 00151 /** 00152 * 三角距離の二乗 00153 * @param capsule カプセル 00154 * @param triangle 三角 00155 * @return 距離の二乗 00156 */ 00157 static float squaredDistance( 00158 const Capsule& capsule, const Triangle& triangle); 00159 00160 private: 00161 //-------------------------------------------------------------------------- 00162 // コンストラクタの隠蔽 00163 CapsuleDistance(); 00164 00165 }; 00166 00167 //------------------------------------------------------------------------------ 00168 } // End of namespace Lamp 00169 #endif // End of CAPSULE_DISTANCE_H_ 00170 //------------------------------------------------------------------------------