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