1 #ifndef BT_CLIP_POLYGON_H_INCLUDED
2 #define BT_CLIP_POLYGON_H_INCLUDED
33 return point.
dot(plane) - plane[3];
40 vr = (1-blend_factor)*va + blend_factor*vb;
54 if(_classif!=_prevclassif)
56 btScalar blendfactor = -dist0/(dist1-dist0);
57 bt_vec_blend(clipped[clipped_count],point0,point1,blendfactor);
62 clipped[clipped_count] = point1;
75 int polygon_point_count,
78 int clipped_count = 0;
85 clipped[clipped_count] = polygon_points[0];
90 for(
int i=1;i<polygon_point_count;i++)
95 polygon_points[i-1],polygon_points[i],
108 polygon_points[polygon_point_count-1],polygon_points[0],
114 return clipped_count;
130 int clipped_count = 0;
136 clipped[clipped_count] = point0;
175 return clipped_count;
182 #endif // GIM_TRI_COLLISION_H_INCLUDED
float dist(const Point3 &pnt0, const Point3 &pnt1)
#define SIMD_FORCE_INLINE
btScalar dot(const btVector3 &v) const
Return the dot product.
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.
btScalar bt_distance_point_plane(const btVector4 &plane, const btVector3 &point)
void bt_vec_blend(btVector3 &vr, const btVector3 &va, const btVector3 &vb, btScalar blend_factor)
int bt_plane_clip_polygon(const btVector4 &plane, const btVector3 *polygon_points, int polygon_point_count, btVector3 *clipped)
Clips a polygon by a plane.
btVector3 can be used to represent 3D points and vectors.
void bt_plane_clip_polygon_collect(const btVector3 &point0, const btVector3 &point1, btScalar dist0, btScalar dist1, btVector3 *clipped, int &clipped_count)
This function calcs the distance from a 3D plane.
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...