| Bullet Collision Detection & Physics Library
    | 
 
 
 
Go to the documentation of this file.    1 #ifndef BT_BASIC_GEOMETRY_OPERATIONS_H_INCLUDED 
    2 #define BT_BASIC_GEOMETRY_OPERATIONS_H_INCLUDED 
   30 #define PLANEDIREPSILON 0.0000001f 
   31 #define PARALELENORMALS 0.000001f 
   33 #define BT_CLAMP(number, minval, maxval) (number < minval ? minval : (number > maxval ? maxval : number)) 
   38         btVector3 planenormal = (e2 - e1).cross(normal);
 
   40         plane.
setValue(planenormal[0], planenormal[1], planenormal[2], e2.
dot(planenormal));
 
   58         else if (_scalar > 1.0f)
 
   64                 cp = _scalar * n + e1;
 
   93         char returnvalue = _dis < 0.0f ? 2 : 1;
 
   94         tparam = -_dis / _dotdir;
 
  101         else if (tparam > tmax)
 
  106         pout = tparam * vDir + vPoint;
 
  129                 bool invert_b_order = 
false;
 
  135                         invert_b_order = 
true;
 
  141                 N[0] = (_M[0] + _M[1]) * 0.5f;
 
  142                 N[1] = (_M[2] + _M[3]) * 0.5f;
 
  148                                 vPointB = invert_b_order ? vB1 : vB2;
 
  151                         else if (_M[1] < _M[3])
 
  153                                 vPointB = invert_b_order ? vB1 : vB2;
 
  166                                 vPointB = invert_b_order ? vB2 : vB1;
 
  169                         else if (_M[3] < _M[1])
 
  176                                 vPointB = invert_b_order ? vB1 : vB2;
 
  190         vPointB = vPointA - vB1;
 
  191         tp = vPointB.
dot(BD);
 
  195         vPointB = tp * BD + vB1;
 
  198 #endif  // GIM_VECTOR_H_INCLUDED 
 
#define BT_CLAMP(number, minval, maxval)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z, const btScalar &_w)
Set x,y,z and zero w.
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.
void bt_edge_plane(const btVector3 &e1, const btVector3 &e2, const btVector3 &normal, btVector4 &plane)
Calc a plane from a triangle edge an a normal. plane is a vec4f.
void bt_segment_collision(const btVector3 &vA1, const btVector3 &vA2, const btVector3 &vB1, const btVector3 &vB2, btVector3 &vPointA, btVector3 &vPointB)
Find closest points on segments.
#define BT_SWAP_NUMBERS(a, b)
Swap numbers.
btScalar btFabs(btScalar x)
btScalar bt_distance_point_plane(const btVector4 &plane, const btVector3 &point)
int bt_line_plane_collision(const btVector4 &plane, const btVector3 &vDir, const btVector3 &vPoint, btVector3 &pout, btScalar &tparam, btScalar tmin, btScalar tmax)
line plane collision
btVector3 can be used to represent 3D points and vectors.
#define SIMD_FORCE_INLINE
void bt_closest_point_on_segment(btVector3 &cp, const btVector3 &v, const btVector3 &e1, const btVector3 &e2)
btVector3 & normalize()
Normalize this vector x^2 + y^2 + z^2 = 1.
btScalar length2() const
Return the length of the vector squared.