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/K3dRay.h" 00036 #include "../Geometry/K3dPlane.h" 00037 #include "../MathCore/K3dVector3.h" 00038 #include "../MathCore/K3dDistance.h" 00039 #include "../MathCore/K3dMath.h" 00040 00041 enum ELinePlanePos 00042 { 00043 K3D_FRONT_LINE=0, 00044 K3D_BACK_LINE, 00045 K3D_ON_PLANE_LINE, 00046 K3D_LINE_INTR_PLANE 00047 }; 00048 00049 class K3dIntrLinePlane: public K3dDistance 00050 { 00051 K3dGameData *m_pGameData; 00052 K3dVector3Obj m_kIntrPoint; 00053 float m_fDistanceOrigin; 00054 float m_fDistanceDirection; 00055 ELinePlanePos m_eLinePos; 00056 public: 00057 K3dIntrLinePlane ( K3dGameData *_pGameData ); 00058 ~K3dIntrLinePlane(); 00059 00060 bool LinePlane ( const K3dRay &_rkLine, const K3dPlane &_rkPlane ); 00061 00063 K3dVector3Obj &GetIntrPoint() 00064 { 00065 return m_kIntrPoint; 00066 } 00067 00069 float &GetDistanceOrigin() 00070 { 00071 return m_fDistanceOrigin; 00072 } 00073 const float &GetDistanceOrigin() const 00074 { 00075 return m_fDistanceOrigin; 00076 } 00077 00079 float &GetDistanceDirection() 00080 { 00081 return m_fDistanceDirection; 00082 } 00083 const float &GetDistanceDirection() const 00084 { 00085 return m_fDistanceDirection; 00086 } 00087 00089 ELinePlanePos &GetLinePlanePos() 00090 { 00091 return m_eLinePos; 00092 } 00093 }; 00094