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