Logo Search packages:      
Sourcecode: blender version File versions

template<typename CLASS_POINT, typename CLASS_PLANE>
SIMD_FORCE_INLINE eLINE_PLANE_INTERSECTION_TYPE PLANE_CLIP_SEGMENT2 ( const CLASS_POINT &  s1,
const CLASS_POINT &  s2,
const CLASS_PLANE &  plane,
CLASS_POINT &  clipped 
) [inline]

Confirms if the plane intersect the edge or nor.

intersection type must have the following values

  • 0 : Segment in front of plane, s1 closest
  • 1 : Segment in front of plane, s2 closest
  • 2 : Segment in back of plane, s1 closest
  • 3 : Segment in back of plane, s2 closest
  • 4 : Segment collides plane, s1 in back
  • 5 : Segment collides plane, s2 in back

Definition at line 156 of file gim_basic_geometry_operations.h.

References VEC_DIFF, VEC_DOT, VEC_SCALE, and VEC_SUM.

Referenced by PLANE_CLIP_SEGMENT_CLOSEST().

{
      GREAL _dis1 = DISTANCE_PLANE_POINT(plane,s1);
      GREAL _dis2 = DISTANCE_PLANE_POINT(plane,s2);
      if(_dis1 >-G_EPSILON && _dis2 >-G_EPSILON)
      {
          if(_dis1<_dis2) return G_FRONT_PLANE_S1;
          return G_FRONT_PLANE_S2;
      }
      else if(_dis1 <G_EPSILON && _dis2 <G_EPSILON)
      {
          if(_dis1>_dis2) return G_BACK_PLANE_S1;
          return G_BACK_PLANE_S2;
      }

      VEC_DIFF(clipped,s2,s1);
      _dis2 = VEC_DOT(clipped,plane);
      VEC_SCALE(clipped,-_dis1/_dis2,clipped);
      VEC_SUM(clipped,clipped,s1);
      if(_dis1<_dis2) return G_COLLIDE_PLANE_S1;
      return G_COLLIDE_PLANE_S2;
}


Generated by  Doxygen 1.6.0   Back to index