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