00001 /*---------------------------------------------------------------------------*\ 00002 * OpenSG * 00003 * * 00004 * * 00005 * Copyright (C) 2000-2002 by the OpenSG Forum * 00006 * * 00007 * www.opensg.org * 00008 * * 00009 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de * 00010 * * 00011 \*---------------------------------------------------------------------------*/ 00012 /*---------------------------------------------------------------------------*\ 00013 * License * 00014 * * 00015 * This library is free software; you can redistribute it and/or modify it * 00016 * under the terms of the GNU Library General Public License as published * 00017 * by the Free Software Foundation, version 2. * 00018 * * 00019 * This library is distributed in the hope that it will be useful, but * 00020 * WITHOUT ANY WARRANTY; without even the implied warranty of * 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00022 * Library General Public License for more details. * 00023 * * 00024 * You should have received a copy of the GNU Library General Public * 00025 * License along with this library; if not, write to the Free Software * 00026 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00027 * * 00028 \*---------------------------------------------------------------------------*/ 00029 /*---------------------------------------------------------------------------*\ 00030 * Changes * 00031 * * 00032 * * 00033 * * 00034 * * 00035 * * 00036 * * 00037 \*---------------------------------------------------------------------------*/ 00038 00039 //--------------------------------------------------------------------------- 00040 // Includes 00041 //--------------------------------------------------------------------------- 00042 00043 00044 #include <stdlib.h> 00045 #include <stdio.h> 00046 00047 #include <OSGConfig.h> 00048 00049 #include <OSGAction.h> 00050 00051 OSG_BEGIN_NAMESPACE 00052 00053 /***************************************************************************\ 00054 * Types * 00055 \***************************************************************************/ 00056 00057 00058 /***************************************************************************\ 00059 * Class variables * 00060 \***************************************************************************/ 00061 00062 00063 /***************************************************************************\ 00064 * Class methods * 00065 \***************************************************************************/ 00066 00067 00068 /*-------------------------------------------------------------------------*\ 00069 - public - 00070 \*-------------------------------------------------------------------------*/ 00071 00072 /*-------------------------------------------------------------------------*\ 00073 - protected - 00074 \*-------------------------------------------------------------------------*/ 00075 00076 00077 /*-------------------------------------------------------------------------*\ 00078 - private - 00079 \*-------------------------------------------------------------------------*/ 00080 00081 00082 /***************************************************************************\ 00083 * Instance methods * 00084 \***************************************************************************/ 00085 00086 /*-------------------------------------------------------------------------*\ 00087 - public - 00088 \*-------------------------------------------------------------------------*/ 00089 00090 /*------------- constructors & destructors --------------------------------*/ 00091 00101 /*------------------------------ access -----------------------------------*/ 00102 00103 inline const Line& IntersectAction::getLine( void ) const 00104 { 00105 return _line; 00106 } 00107 00108 inline Real32 IntersectAction::getMaxDist( void ) const 00109 { 00110 return _maxdist; 00111 } 00112 00113 inline bool IntersectAction::didHit( void ) const 00114 { 00115 return _hit; 00116 } 00117 00118 inline Real32 IntersectAction::getHitT( void ) const 00119 { 00120 if ( ! didHit() ) 00121 return -1; 00122 return _hitT; 00123 } 00124 00125 inline Pnt3f IntersectAction::getHitPoint( void ) const 00126 { 00127 if ( ! didHit() ) 00128 return Pnt3f::Null; 00129 00130 Pnt3f res; 00131 res = _line.getPosition() + getHitT() * _line.getDirection(); 00132 return res; 00133 } 00134 00135 inline Vec3f IntersectAction::getHitNormal( void ) const 00136 { 00137 if ( ! didHit() ) 00138 return Vec3f::Null; 00139 00140 return _hitNormal; 00141 } 00142 00143 inline NodePtr IntersectAction::getHitObject( void ) const 00144 { 00145 if ( ! didHit() ) 00146 return NullFC; 00147 00148 return _hitObject; 00149 } 00150 00151 inline Int32 IntersectAction::getHitTriangle( void ) const 00152 { 00153 if ( ! didHit() ) 00154 return -1; 00155 return _hitTriangle; 00156 } 00157 00158 /*---------------------------- properties ---------------------------------*/ 00159 00160 /*-------------------------- your_category---------------------------------*/ 00161 00162 /*-------------------------- assignment -----------------------------------*/ 00163 00168 /*-------------------------- comparison -----------------------------------*/ 00169 00183 /*-------------------------------------------------------------------------*\ 00184 - protected - 00185 \*-------------------------------------------------------------------------*/ 00186 00187 00188 00189 /*-------------------------------------------------------------------------*\ 00190 - private - 00191 \*-------------------------------------------------------------------------*/ 00192 00193 OSG_END_NAMESPACE 00194 00198 //: Example for the head comment of a function 00201 //p: Paramaters: 00202 //p: 00204 //g: GlobalVars: 00205 //g: 00207 //r: Return: 00208 //r: 00210 //c: Caution: 00211 //c: 00213 //a: Assumptions: 00214 //a: 00216 //d: Description: 00217 //d: 00219 //s: SeeAlso: 00220 //s: 00222
1.4.3