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 AXIS_ALIGNED_BOX_DISTANCE_H_ 00026 #define AXIS_ALIGNED_BOX_DISTANCE_H_ 00027 00028 namespace Lamp{ 00029 00030 class AxisAlignedBox; 00031 class Capsule; 00032 class Cone; 00033 class Line; 00034 class OrientedBox; 00035 class Plane; 00036 class Ray; 00037 class Segment; 00038 class Sphere; 00039 class Triangle; 00040 00041 //------------------------------------------------------------------------------ 00042 /** 00043 * 軸沿いボックス距離 00044 */ 00045 class AxisAlignedBoxDistance{ 00046 public: 00047 //-------------------------------------------------------------------------- 00048 // 点 00049 //-------------------------------------------------------------------------- 00050 /** 00051 * 点距離の二乗 00052 * @param aab 軸沿いボックス 00053 * @param point 点 00054 * @return 距離の二乗 00055 */ 00056 static float squaredDistance( 00057 const AxisAlignedBox& aab, const Vector3& point); 00058 00059 //-------------------------------------------------------------------------- 00060 // 軸沿いボックス 00061 //-------------------------------------------------------------------------- 00062 /** 00063 * 軸沿いボックス距離の二乗 00064 * @param aab0 軸沿いボックス 00065 * @param aab1 軸沿いボックス 00066 * @return 距離の二乗 00067 */ 00068 static float squaredDistance( 00069 const AxisAlignedBox& aab0, const AxisAlignedBox& aab1); 00070 00071 //-------------------------------------------------------------------------- 00072 // カプセル 00073 //-------------------------------------------------------------------------- 00074 /** 00075 * カプセル距離の二乗 00076 * @param aab 軸沿いボックス 00077 * @param capsule カプセル 00078 * @return 距離の二乗 00079 */ 00080 static float squaredDistance( 00081 const AxisAlignedBox& aab, const Capsule& capsule); 00082 00083 //-------------------------------------------------------------------------- 00084 // コーン 00085 //-------------------------------------------------------------------------- 00086 /** 00087 * コーン距離の二乗 00088 * @param aab 軸沿いボックス 00089 * @param cone コーン 00090 * @return 距離の二乗 00091 */ 00092 static float squaredDistance(const AxisAlignedBox& aab, const Cone& cone); 00093 00094 //-------------------------------------------------------------------------- 00095 // ライン 00096 //-------------------------------------------------------------------------- 00097 /** 00098 * ライン距離の二乗 00099 * @param aab 軸沿いボックス 00100 * @param line ライン 00101 * @return 距離の二乗 00102 */ 00103 static float squaredDistance(const AxisAlignedBox& aab, const Line& line); 00104 00105 //-------------------------------------------------------------------------- 00106 // 指向性ボックス 00107 //-------------------------------------------------------------------------- 00108 /** 00109 * 指向性ボックス距離の二乗 00110 * @param aab 軸沿いボックス 00111 * @param ob 指向性ボックス 00112 * @return 距離の二乗 00113 */ 00114 static float squaredDistance( 00115 const AxisAlignedBox& aab, const OrientedBox& ob); 00116 00117 //-------------------------------------------------------------------------- 00118 // 平面 00119 //-------------------------------------------------------------------------- 00120 /** 00121 * 平面距離 00122 * @param aab 軸沿いボックス 00123 * @param plane 平面 00124 * @return 距離 00125 */ 00126 static float distance(const AxisAlignedBox& aab, const Plane& plane); 00127 00128 //-------------------------------------------------------------------------- 00129 // レイ 00130 //-------------------------------------------------------------------------- 00131 /** 00132 * レイ距離の二乗 00133 * @param aab 軸沿いボックス 00134 * @param ray レイ 00135 * @return 距離の二乗 00136 */ 00137 static float squaredDistance(const AxisAlignedBox& aab, const Ray& ray); 00138 00139 //-------------------------------------------------------------------------- 00140 // セグメント 00141 //-------------------------------------------------------------------------- 00142 /** 00143 * セグメント距離の二乗 00144 * @param aab 軸沿いボックス 00145 * @param segment セグメント 00146 * @return 距離の二乗 00147 */ 00148 static float squaredDistance( 00149 const AxisAlignedBox& aab, const Segment& segment); 00150 00151 //-------------------------------------------------------------------------- 00152 // 球 00153 //-------------------------------------------------------------------------- 00154 /** 00155 * 球距離の二乗 00156 * @param aab 軸沿いボックス 00157 * @param sphere 球 00158 * @return 距離の二乗 00159 */ 00160 static float squaredDistance( 00161 const AxisAlignedBox& aab, const Sphere& sphere); 00162 00163 //-------------------------------------------------------------------------- 00164 // 三角 00165 //-------------------------------------------------------------------------- 00166 /** 00167 * 三角距離の二乗 00168 * @param aab 軸沿いボックス 00169 * @param triangle 三角 00170 * @return 距離の二乗 00171 */ 00172 static float squaredDistance( 00173 const AxisAlignedBox& aab, const Triangle& triangle); 00174 00175 private: 00176 //-------------------------------------------------------------------------- 00177 // コンストラクタの隠蔽 00178 AxisAlignedBoxDistance(); 00179 00180 }; 00181 00182 //------------------------------------------------------------------------------ 00183 } // End of namespace Lamp 00184 #endif // End of AXIS_ALIGNED_BOX_DISTANCE_H_ 00185 //------------------------------------------------------------------------------