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

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

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