| Bullet Collision Detection & Physics Library
    | 
 
 
 
Go to the documentation of this file.
   36 #define TRI_LOCAL_EPSILON 0.000001f 
   37 #define MIN_EDGE_EDGE_DIS 0.00001f 
   77                         scale_edge0 = -D2 / (D0 - D2);
 
   78                         scale_edge1 = -D1 / (D2 - D1);
 
   85                         scale_edge0 = -D0 / (D1 - D0);
 
   86                         scale_edge1 = -D1 / (D2 - D1);
 
   90                 else if (D1 * D2 > 0.0f || D0 != 0.0f)
 
   93                         scale_edge0 = -D0 / (D1 - D0);
 
   94                         scale_edge1 = -D2 / (D0 - D2);
 
  118                 EDGE_PLANE(tripoints[0], tripoints[1], tri_plane, edgeplane);
 
  121                         edgeplane, srcpoints[0], srcpoints[1], srcpoints[2], 
temp_points);
 
  123                 if (clipped_count == 0) 
return 0;
 
  127                 EDGE_PLANE(tripoints[1], tripoints[2], tri_plane, edgeplane);
 
  132                 if (clipped_count == 0) 
return 0;
 
  136                 EDGE_PLANE(tripoints[2], tripoints[0], tri_plane, edgeplane);
 
  141                 return clipped_count;
 
  213                 GREAL tu_scale_e0, tu_scale_e1;  
 
  215                                                            du0du1, 
du0du2, tu_scale_e0, tu_scale_e1, tu_e0, tu_e1)) 
return 0;
 
  219                 GREAL tv_scale_e0, tv_scale_e1;  
 
  222                                                            dv0dv1, 
dv0dv2, tv_scale_e0, tv_scale_e1, tv_e0, tv_e1)) 
return 0;
 
  235                 sort_isect(isect_u[0], isect_u[1], tu_e0, tu_e1, up_e0, up_e1);
 
  236                 sort_isect(isect_v[0], isect_v[1], tv_e0, tv_e1, vp_e0, vp_e1);
 
  238                 const GREAL midpoint_u = 0.5f * (isect_u[0] + isect_u[1]);  
 
  239                 const GREAL midpoint_v = 0.5f * (isect_v[0] + isect_v[1]);  
 
  241                 if (midpoint_u < midpoint_v)
 
  243                         if (isect_u[1] >= isect_v[1])  
 
  247                         else if (isect_v[0] <= isect_u[0])  
 
  276                         if (isect_v[1] >= isect_u[1])  
 
  280                         else if (isect_u[0] <= isect_v[0])  
 
  322                 margin = margin_u + margin_v;
 
  463                         if (point_count == 0) 
return false;
 
  469                         if (point_count == 0) 
return false;
 
  
#define TRIANGLE_PLANE(v1, v2, v3, plane)
plane is a vec4f
#define EDGE_PLANE(e1, e2, n, plane)
Calc a plane from an edge an a normal. plane is a vec4f.
#define VEC_LENGTH(a, l)
Vector length.
btVector3 cross(const btVector3 &v) const
Return the cross product between this and another vector.
btScalar dot(const btVector3 &v) const
Return the dot product.
btVector3 temp_points1[MAX_TRI_CLIPPING]
btVector3 closest_point_v
#define VEC_SWAP(b, a)
VECTOR SWAP.
#define GIM_SWAP_NUMBERS(a, b)
Swap numbers.
GUINT cross_line_intersection_test()
Test verifying interval intersection with the direction between planes.
GUINT clip_triangle(const btVector4 &tri_plane, const btVector3 *tripoints, const btVector3 *srcpoints, btVector3 *clip_points)
clip triangle
Class for colliding triangles.
bool collide_triangle_hard_test(const GIM_TRIANGLE &other, GIM_TRIANGLE_CONTACT_DATA &contact_data) const
Test triangles by finding separating axis.
btVector3 lerp(const btVector3 &v, const btScalar &t) const
Return the linear interpolation between this and another vector.
void SEGMENT_COLLISION(const CLASS_POINT &vA1, const CLASS_POINT &vA2, const CLASS_POINT &vB1, const CLASS_POINT &vB2, CLASS_POINT &vPointA, CLASS_POINT &vPointB)
Find closest points on segments.
btVector3 temp_points[MAX_TRI_CLIPPING]
btVector3 can be used to represent 3D points and vectors.
#define VEC_SCALE_4(c, a, b)
scalar times vector
#define SIMD_FORCE_INLINE
bool triangle_collision(const btVector3 &u0, const btVector3 &u1, const btVector3 &u2, GREAL margin_u, const btVector3 &v0, const btVector3 &v1, const btVector3 &v2, GREAL margin_v, GIM_TRIANGLE_CONTACT_DATA &contacts)
collides by two sides
GUINT PLANE_CLIP_POLYGON3D(const CLASS_PLANE &plane, const CLASS_POINT *polygon_points, GUINT polygon_point_count, CLASS_POINT *clipped)
btVector3 closest_point_u
#define MIN_EDGE_EDGE_DIS
#define DISTANCE_PLANE_POINT(plane, point)
#define GIM_MIN3(a, b, c)
bool compute_intervals(const GREAL &D0, const GREAL &D1, const GREAL &D2, const GREAL &D0D1, const GREAL &D0D2, GREAL &scale_edge0, GREAL &scale_edge1, GUINT &edge_index0, GUINT &edge_index1)
if returns false, the faces are paralele
#define GIM_MAX3(a, b, c)
#define VEC_COPY(b, a)
Copy 3D vector.
GUINT PLANE_CLIP_TRIANGLE3D(const CLASS_PLANE &plane, const CLASS_POINT &point0, const CLASS_POINT &point1, const CLASS_POINT &point2, CLASS_POINT *clipped)
void sort_isect(GREAL &isect0, GREAL &isect1, GUINT &e0, GUINT &e1, btVector3 &vec0, btVector3 &vec1)
btVector3 contact_points[MAX_TRI_CLIPPING]