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