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