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 * ƒŒƒCŒð·ŽÀ‘• 00022 * @author Junpee 00023 */ 00024 00025 #include "LampBasic.h" 00026 #include "Geometry/Intersection/RayIntersection.h" 00027 00028 namespace Lamp{ 00029 00030 //------------------------------------------------------------------------------ 00031 // “_ 00032 //------------------------------------------------------------------------------ 00033 // “_Œð· 00034 bool RayIntersection::intersect( 00035 const Ray& ray, const Vector3& point, float range){ 00036 Assert(false); 00037 return false; 00038 } 00039 //------------------------------------------------------------------------------ 00040 // ƒŒƒC 00041 //------------------------------------------------------------------------------ 00042 // ƒŒƒCŒð· 00043 bool RayIntersection::intersect(const Ray& ray0, const Ray& ray1, float range){ 00044 return (ray0.getSquaredDistance(ray1) <= (range * range)); 00045 } 00046 //------------------------------------------------------------------------------ 00047 // ƒZƒOƒƒ“ƒg 00048 //------------------------------------------------------------------------------ 00049 // ƒZƒOƒƒ“ƒgŒð· 00050 bool RayIntersection::intersect( 00051 const Ray& ray, const Segment& segment, float range){ 00052 return (ray.getSquaredDistance(segment) <= (range * range)); 00053 } 00054 //------------------------------------------------------------------------------ 00055 // ‹… 00056 //------------------------------------------------------------------------------ 00057 // ‹…Œð· 00058 bool RayIntersection::intersect(const Ray& ray, const Sphere& sphere){ 00059 // ‹…’†S‚Ƃ̋——£‚ª‹…”¼ŒaˆÈ“à‚È‚çŒð·‚·‚é 00060 float squaredDistance = ray.getSquaredDistance(sphere.getCenter()); 00061 float radius = sphere.getRadius(); 00062 return (squaredDistance <= (radius * radius)); 00063 } 00064 //------------------------------------------------------------------------------ 00065 // ŽOŠp 00066 //------------------------------------------------------------------------------ 00067 // ŽOŠpŒð· 00068 bool RayIntersection::intersect(const Ray& ray, const Triangle& triangle){ 00069 Assert(false); 00070 return false; 00071 } 00072 //------------------------------------------------------------------------------ 00073 } // End of namespace Lamp 00074 //------------------------------------------------------------------------------