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

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

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