1 #ifndef BT_BASIC_GEOMETRY_OPERATIONS_H_INCLUDED 2 #define BT_BASIC_GEOMETRY_OPERATIONS_H_INCLUDED 34 #define PLANEDIREPSILON 0.0000001f 35 #define PARALELENORMALS 0.000001f 38 #define BT_CLAMP(number,minval,maxval) (number<minval?minval:(number>maxval?maxval:number)) 43 btVector3 planenormal = (e2-e1).cross(normal);
45 plane.
setValue(planenormal[0],planenormal[1],planenormal[2],e2.
dot(planenormal));
65 else if(_scalar >1.0f)
102 char returnvalue = _dis<0.0f? 2:1;
103 tparam = -_dis/_dotdir;
115 pout = tparam*vDir + vPoint;
139 bool invert_b_order =
false;
145 invert_b_order =
true;
151 N[0] = (_M[0]+_M[1])*0.5f;
152 N[1] = (_M[2]+_M[3])*0.5f;
158 vPointB = invert_b_order?vB1:vB2;
163 vPointB = invert_b_order?vB1:vB2;
176 vPointB = invert_b_order?vB2:vB1;
186 vPointB = invert_b_order?vB1:vB2;
200 vPointB = vPointA - vB1;
201 tp = vPointB.
dot(BD);
205 vPointB = tp*BD + vB1;
212 #endif // GIM_VECTOR_H_INCLUDED
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.
btScalar length2() const
Return the length of the vector squared.
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
#define SIMD_FORCE_INLINE
btVector3 & normalize()
Normalize this vector x^2 + y^2 + z^2 = 1.
#define BT_CLAMP(number, minval, maxval)
btScalar bt_distance_point_plane(const btVector4 &plane, const btVector3 &point)
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_segment_collision(const btVector3 &vA1, const btVector3 &vA2, const btVector3 &vB1, const btVector3 &vB2, btVector3 &vPointA, btVector3 &vPointB)
Find closest points on segments.
btVector3 can be used to represent 3D points and vectors.
void bt_closest_point_on_segment(btVector3 &cp, const btVector3 &v, const btVector3 &e1, const btVector3 &e2)
#define BT_SWAP_NUMBERS(a, b)
Swap numbers.
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.
btScalar btFabs(btScalar x)