00001 00012 /*************************************************************************** 00013 * Copyright (C) 2007 by Jan Koci * 00014 * honza.koci@email.cz * 00015 * http://kengine.sourceforge.net/tutorial/ 00016 * * 00017 * This program is free software; you can redistribute it and/or modify * 00018 * it under the terms of the GNU General Public License as published by * 00019 * the Free Software Foundation; either version 2 of the License, or * 00020 * (at your option) any later version. * 00021 * * 00022 * This program is distributed in the hope that it will be useful, * 00023 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00024 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00025 * GNU General Public License for more details. * 00026 * * 00027 * You should have received a copy of the GNU General Public License * 00028 * along with this program; if not, write to the * 00029 * Free Software Foundation, Inc., * 00030 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00031 ***************************************************************************/ 00032 00033 #pragma once 00034 00035 #include "../Geometry/K3dPlaneObj.h" 00036 #include "K3dVector3Obj.h" 00037 #include "../Geometry/K3dRay.h" 00038 #include "../Geometry/K3dLine.h" 00039 #include "K3dDistance.h" 00040 #include "../Geometry/K3dTriangle.h" 00041 #include "K3dIntrLinSph.h" 00042 #include "../System/Worker/K3dPlaneWork.h" 00043 00044 00045 class K3dIntersection: public K3dIntrLinSph 00046 { 00047 K3dGameData *m_pGameData; 00048 K3dPlaneObj *m_pTrianglePlane; 00049 public: 00050 K3dIntersection ( K3dGameData *_pGameData ); 00051 ~K3dIntersection(); 00052 00053 // Find the point where a ray intersect a plane 00054 bool RayPlane ( const K3dRay &_rkRay, const K3dPlane &_rkPlane, K3dVector3Obj &_rkIPoint ); 00055 // Find the point where a line intersect a triangle 00056 bool LineTriangle ( const K3dRay &_rkEdge, const K3dTriangle &_rkTriangle ); 00057 // Find the point where a ray intersect a triangle 00058 bool RayTriangle ( const K3dRay &_rkRay, const K3dTriangle &_rkTriangle, K3dVector3Obj &_rkIPoint ); 00059 00061 K3dPlaneObj *GetTrianglePlane() 00062 { 00063 return m_pTrianglePlane; 00064 } 00065 00067 void SetTrianglePlane ( K3dPlaneObj *_pTrianglePlane ) 00068 { 00069 m_pTrianglePlane = _pTrianglePlane; 00070 } 00071 }; 00072