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

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

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