Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

AxisAlignedBox.cpp

Go to the documentation of this file.
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 #include "LampBasic.h"
00026 #include "Geometry/Primitive/AxisAlignedBox.h"
00027 #include "Geometry/Distance/AxisAlignedBoxDistance.h"
00028 #include "Geometry/Intersection/AxisAlignedBoxIntersection.h"
00029 
00030 namespace Lamp{
00031 
00032 //------------------------------------------------------------------------------
00033 // 定数
00034 //------------------------------------------------------------------------------
00035 // ゼロボックス
00036 const AxisAlignedBox AxisAlignedBox::zero(0.f, 0.f, 0.f, 0.f, 0.f, 0.f);
00037 
00038 // 単位ボックス
00039 const AxisAlignedBox AxisAlignedBox::unit(
00040     -0.5f, -0.5f, -0.5f, 0.5f, 0.5f, 0.5f);
00041 
00042 //------------------------------------------------------------------------------
00043 // 距離
00044 //------------------------------------------------------------------------------
00045 // 点距離の二乗
00046 float AxisAlignedBox::getSquaredDistance(const Vector3& point) const{
00047     return AxisAlignedBoxDistance::squaredDistance(*this, point);
00048 }
00049 //------------------------------------------------------------------------------
00050 // 軸沿いボックス距離の二乗
00051 float AxisAlignedBox::getSquaredDistance(
00052     const AxisAlignedBox& axisAlignedBox) const{
00053     return AxisAlignedBoxDistance::squaredDistance(*this, axisAlignedBox);
00054 }
00055 //------------------------------------------------------------------------------
00056 // カプセル距離の二乗
00057 float AxisAlignedBox::getSquaredDistance(const Capsule& capsule) const{
00058     return AxisAlignedBoxDistance::squaredDistance(*this, capsule);
00059 }
00060 //------------------------------------------------------------------------------
00061 // コーン距離の二乗
00062 float AxisAlignedBox::getSquaredDistance(const Cone& cone) const{
00063     return AxisAlignedBoxDistance::squaredDistance(*this, cone);
00064 }
00065 //------------------------------------------------------------------------------
00066 // ライン距離の二乗
00067 float AxisAlignedBox::getSquaredDistance(const Line& line) const{
00068     return AxisAlignedBoxDistance::squaredDistance(*this, line);
00069 }
00070 //------------------------------------------------------------------------------
00071 // 指向性ボックス距離の二乗
00072 float AxisAlignedBox::getSquaredDistance(const OrientedBox& orientedBox) const{
00073     return AxisAlignedBoxDistance::squaredDistance(*this, orientedBox);
00074 }
00075 //------------------------------------------------------------------------------
00076 // 平面距離
00077 float AxisAlignedBox::getDistance(const Plane& plane) const{
00078     return AxisAlignedBoxDistance::distance(*this, plane);
00079 }
00080 //------------------------------------------------------------------------------
00081 // レイ距離の二乗
00082 float AxisAlignedBox::getSquaredDistance(const Ray& ray) const{
00083     return AxisAlignedBoxDistance::squaredDistance(*this, ray);
00084 }
00085 //------------------------------------------------------------------------------
00086 // セグメント距離の二乗
00087 float AxisAlignedBox::getSquaredDistance(const Segment& segment) const{
00088     return AxisAlignedBoxDistance::squaredDistance(*this, segment);
00089 }
00090 //------------------------------------------------------------------------------
00091 // 球距離の二乗
00092 float AxisAlignedBox::getSquaredDistance(const Sphere& sphere) const{
00093     return AxisAlignedBoxDistance::squaredDistance(*this, sphere);
00094 }
00095 //------------------------------------------------------------------------------
00096 // 三角距離の二乗
00097 float AxisAlignedBox::getSquaredDistance(const Triangle& triangle) const{
00098     return AxisAlignedBoxDistance::squaredDistance(*this, triangle);
00099 }
00100 //------------------------------------------------------------------------------
00101 // 交差
00102 //------------------------------------------------------------------------------
00103 // 点交差
00104 bool AxisAlignedBox::intersect(const Vector3& point) const{
00105     return AxisAlignedBoxIntersection::intersect(*this, point);
00106 }
00107 //------------------------------------------------------------------------------
00108 // 軸沿いボックス交差
00109 bool AxisAlignedBox::intersect(const AxisAlignedBox& axisAlignedBox) const{
00110     return AxisAlignedBoxIntersection::intersect(*this, axisAlignedBox);
00111 }
00112 //------------------------------------------------------------------------------
00113 // カプセル交差
00114 bool AxisAlignedBox::intersect(const Capsule& capsule) const{
00115     return AxisAlignedBoxIntersection::intersect(*this, capsule);
00116 }
00117 //------------------------------------------------------------------------------
00118 // コーン交差
00119 bool AxisAlignedBox::intersect(const Cone& cone) const{
00120     return AxisAlignedBoxIntersection::intersect(*this, cone);
00121 }
00122 //------------------------------------------------------------------------------
00123 // ライン交差
00124 bool AxisAlignedBox::intersect(const Line& line) const{
00125     return AxisAlignedBoxIntersection::intersect(*this, line);
00126 }
00127 //------------------------------------------------------------------------------
00128 // 指向性ボックス交差
00129 bool AxisAlignedBox::intersect(const OrientedBox& orientedBox) const{
00130     return AxisAlignedBoxIntersection::intersect(*this, orientedBox);
00131 }
00132 //------------------------------------------------------------------------------
00133 // 平面交差
00134 bool AxisAlignedBox::intersect(const Plane& plane) const{
00135     return AxisAlignedBoxIntersection::intersect(*this, plane);
00136 }
00137 //------------------------------------------------------------------------------
00138 // レイ交差
00139 bool AxisAlignedBox::intersect(const Ray& ray) const{
00140     return AxisAlignedBoxIntersection::intersect(*this, ray);
00141 }
00142 //------------------------------------------------------------------------------
00143 // セグメント交差
00144 bool AxisAlignedBox::intersect(const Segment& segment) const{
00145     return AxisAlignedBoxIntersection::intersect(*this, segment);
00146 }
00147 //------------------------------------------------------------------------------
00148 // 球交差
00149 bool AxisAlignedBox::intersect(const Sphere& sphere) const{
00150     return AxisAlignedBoxIntersection::intersect(*this, sphere);
00151 }
00152 //------------------------------------------------------------------------------
00153 // 三角交差
00154 bool AxisAlignedBox::intersect(const Triangle& triangle) const{
00155     return AxisAlignedBoxIntersection::intersect(*this, triangle);
00156 }
00157 //------------------------------------------------------------------------------
00158 } // End of namespace Lamp
00159 //------------------------------------------------------------------------------

Generated on Wed Mar 16 10:29:27 2005 for Lamp by doxygen 1.3.2