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