Logo Search packages:      
Sourcecode: blender version File versions

template<typename CLASS_POINT, typename CLASS_PLANE>
SIMD_FORCE_INLINE bool INTERSECT_PLANES ( const CLASS_PLANE &  p1,
const CLASS_PLANE &  p2,
CLASS_POINT &  p,
CLASS_POINT &  d 
) [inline]

Returns the Ray on which 2 planes intersect if they do. Written by Rodrigo Hernandez on ODE convex collision.

Parameters:
p1 Plane 1
p2 Plane 2
p Contains the origin of the ray upon returning if planes intersect
d Contains the direction of the ray upon returning if planes intersect
Returns:
true if the planes intersect, 0 if paralell.

Definition at line 316 of file gim_basic_geometry_operations.h.

References VEC_CROSS, and VEC_DOT.

{
      VEC_CROSS(d,p1,p2);
      GREAL denom = VEC_DOT(d, d);
      if(GIM_IS_ZERO(denom)) return false;
      vec3f _n;
      _n[0]=p1[3]*p2[0] - p2[3]*p1[0];
      _n[1]=p1[3]*p2[1] - p2[3]*p1[1];
      _n[2]=p1[3]*p2[2] - p2[3]*p1[2];
      VEC_CROSS(p,_n,d);
      p[0]/=denom;
      p[1]/=denom;
      p[2]/=denom;
      return true;
}


Generated by  Doxygen 1.6.0   Back to index