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 RAY_INTERSECTION_H_ 00026 #define RAY_INTERSECTION_H_ 00027 00028 namespace Lamp{ 00029 00030 class Ray; 00031 class Segment; 00032 class Sphere; 00033 class Triangle; 00034 00035 //------------------------------------------------------------------------------ 00036 /** 00037 * レイ交差 00038 */ 00039 class RayIntersection{ 00040 public: 00041 //-------------------------------------------------------------------------- 00042 // 点 00043 //-------------------------------------------------------------------------- 00044 /** 00045 * 点交差 00046 * @param ray レイ 00047 * @param point 点 00048 * @param range 交差範囲 00049 * @return 交差していればtrue 00050 */ 00051 static bool intersect(const Ray& ray, const Vector3& point, 00052 float range = Math::epsilon); 00053 00054 //-------------------------------------------------------------------------- 00055 // レイ 00056 //-------------------------------------------------------------------------- 00057 /** 00058 * 交差 00059 * @param ray0 レイ 00060 * @param ray1 レイ 00061 * @param range 交差範囲 00062 * @return 交差していればtrue 00063 */ 00064 static bool intersect(const Ray& ray0, const Ray& ray1, 00065 float range = Math::epsilon); 00066 00067 //-------------------------------------------------------------------------- 00068 // セグメント 00069 //-------------------------------------------------------------------------- 00070 /** 00071 * セグメント交差 00072 * @param ray レイ 00073 * @param segment セグメント 00074 * @param range 交差範囲 00075 * @return 交差していればtrue 00076 */ 00077 static bool intersect(const Ray& ray, const Segment& segment, 00078 float range = Math::epsilon); 00079 00080 //-------------------------------------------------------------------------- 00081 // 球 00082 //-------------------------------------------------------------------------- 00083 /** 00084 * 球交差 00085 * @param ray レイ 00086 * @param sphere 球 00087 * @return 交差していればtrue 00088 */ 00089 static bool intersect(const Ray& ray, const Sphere& sphere); 00090 00091 //-------------------------------------------------------------------------- 00092 // 三角 00093 //-------------------------------------------------------------------------- 00094 /** 00095 * 三角交差 00096 * @param ray レイ 00097 * @param triangle 三角 00098 * @return 交差していればtrue 00099 */ 00100 static bool intersect(const Ray& ray, const Triangle& triangle); 00101 00102 private: 00103 //-------------------------------------------------------------------------- 00104 // コンストラクタの隠蔽 00105 RayIntersection(); 00106 00107 }; 00108 00109 //------------------------------------------------------------------------------ 00110 } // End of namespace Lamp 00111 #endif // End of RAY_INTERSECTION_H_ 00112 //------------------------------------------------------------------------------