Logo Search packages:      
Sourcecode: blender version File versions

SIMD_FORCE_INLINE int bt_plane_clip_triangle ( const btVector4 &  plane,
const btVector3 point0,
const btVector3 point1,
const btVector3 point2,
btVector3 clipped 
)

Clips a polygon by a plane.

Parameters:
clipped must be an array of 16 points.
Returns:
The count of the clipped counts

Definition at line 125 of file btClipPolygon.h.

References bt_plane_clip_polygon_collect().

{
    int clipped_count = 0;

    //clip first point0
      btScalar firstdist = bt_distance_point_plane(plane,point0);;
      if(!(firstdist>SIMD_EPSILON))
      {
            clipped[clipped_count] = point0;
            clipped_count++;
      }

      // point 1
      btScalar olddist = firstdist;
      btScalar dist = bt_distance_point_plane(plane,point1);

      bt_plane_clip_polygon_collect(
                              point0,point1,
                              olddist,
                              dist,
                              clipped,
                              clipped_count);

      olddist = dist;


      // point 2
      dist = bt_distance_point_plane(plane,point2);

      bt_plane_clip_polygon_collect(
                              point1,point2,
                              olddist,
                              dist,
                              clipped,
                              clipped_count);
      olddist = dist;



      //RETURN TO FIRST  point0
      bt_plane_clip_polygon_collect(
                              point2,point0,
                              olddist,
                              firstdist,
                              clipped,
                              clipped_count);

      return clipped_count;
}


Generated by  Doxygen 1.6.0   Back to index