Logo Search packages:      
Sourcecode: blender version File versions

template<typename T, typename CLASS_POINT, typename CLASS_PLANE>
SIMD_FORCE_INLINE bool RAY_PLANE_COLLISION ( const CLASS_PLANE &  plane,
const CLASS_POINT &  vDir,
const CLASS_POINT &  vPoint,
CLASS_POINT &  pout,
T &  tparam 
) [inline]

Ray plane collision in one way.

Intersects plane in one way only. The ray must face the plane (normals must be in opossite directions).
It uses the PLANEDIREPSILON constant.

Definition at line 243 of file gim_basic_geometry_operations.h.

References VEC_DOT, VEC_SCALE, and VEC_SUM.

{
      GREAL _dis,_dotdir;
      _dotdir = VEC_DOT(plane,vDir);
      if(_dotdir<PLANEDIREPSILON)
      {
          return false;
      }
      _dis = DISTANCE_PLANE_POINT(plane,vPoint);
      tparam = -_dis/_dotdir;
      VEC_SCALE(pout,tparam,vDir);
      VEC_SUM(pout,vPoint,pout);
      return true;
}


Generated by  Doxygen 1.6.0   Back to index