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))
39 planenormal.normalize();
40 plane.
setValue(planenormal[0], planenormal[1], planenormal[2], e2.dot(planenormal));
53 btScalar _scalar = cp.dot(n) / n.dot(n);
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;
ATTR_WARN_UNUSED_RESULT const BMVert * v
#define BT_SWAP_NUMBERS(a, b)
Swap numbers.
SIMD_FORCE_INLINE btScalar bt_distance_point_plane(const btVector4 &plane, const btVector3 &point)
SIMD_FORCE_INLINE 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
SIMD_FORCE_INLINE 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.
SIMD_FORCE_INLINE 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_CLAMP(number, minval, maxval)
SIMD_FORCE_INLINE void bt_closest_point_on_segment(btVector3 &cp, const btVector3 &v, const btVector3 &e1, const btVector3 &e2)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
SIMD_FORCE_INLINE btScalar btFabs(btScalar x)
#define SIMD_FORCE_INLINE
btVector3
btVector3 can be used to represent 3D points and vectors. It has an un-used w component to suit 16-by...
SIMD_FORCE_INLINE void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z, const btScalar &_w)
Set x,y,z and zero w.
IconTextureDrawCall normal
vec_base< T, 3 > cross(const vec_base< T, 3 > &a, const vec_base< T, 3 > &b)