Logo Search packages:      
Sourcecode: blender version File versions  Download package

SIMD_FORCE_INLINE int bt_line_plane_collision ( const btVector4 &  plane,
const btVector3 &  vDir,
const btVector3 &  vPoint,
btVector3 &  pout,
btScalar &  tparam,
btScalar  tmin,
btScalar  tmax 
)

line plane collision

Returns:
-0 if the ray never intersects -1 if the ray collides in front -2 if the ray collides in back

Definition at line 84 of file btGeometryOperations.h.

Referenced by bt_segment_collision().

{

      btScalar _dotdir = vDir.dot(plane);

      if(btFabs(_dotdir)<PLANEDIREPSILON)
      {
            tparam = tmax;
          return 0;
      }

      btScalar _dis = bt_distance_point_plane(plane,vPoint);
      char returnvalue = _dis<0.0f? 2:1;
      tparam = -_dis/_dotdir;

      if(tparam<tmin)
      {
            returnvalue = 0;
            tparam = tmin;
      }
      else if(tparam>tmax)
      {
            returnvalue = 0;
            tparam = tmax;
      }
      pout = tparam*vDir + vPoint;
      return returnvalue;
}


Generated by  Doxygen 1.6.0   Back to index