moved SAT code into collision module
This commit is contained in:
@ -52,4 +52,57 @@ float32 b3Project(const b3Vec3& P1, const b3Vec3& E1, const b3Vec3& P2, const b3
|
||||
b3EdgeQuery b3QueryEdgeSeparation(const b3Transform& xf1, const b3Hull* hull1,
|
||||
const b3Transform& xf2, const b3Hull* hull2);
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
enum b3SATCacheType
|
||||
{
|
||||
e_separation,
|
||||
e_overlap,
|
||||
e_empty,
|
||||
};
|
||||
|
||||
enum b3SATFeatureType
|
||||
{
|
||||
e_edge1, // an edge on hull 1 and an edge on hull 2
|
||||
e_face1, // a face on hull 1 and a vertex/edge/face on hull 2
|
||||
e_face2, // a face on hull 2 and a vertex/edge/face on hull 1
|
||||
};
|
||||
|
||||
// A cached feature pair is used to improve the performance
|
||||
// of the SAT when called more than once.
|
||||
struct b3SATFeaturePair
|
||||
{
|
||||
b3SATCacheType state; // sat result
|
||||
b3SATFeatureType type; // feature pair type
|
||||
u32 index1; // feature index on hull 1
|
||||
u32 index2; // feature index on hull 2
|
||||
};
|
||||
|
||||
inline b3SATFeaturePair b3MakeFeaturePair(b3SATCacheType state, b3SATFeatureType type, u32 index1, u32 index2)
|
||||
{
|
||||
b3SATFeaturePair pair;
|
||||
pair.state = state;
|
||||
pair.type = type;
|
||||
pair.index1 = index1;
|
||||
pair.index2 = index2;
|
||||
return pair;
|
||||
}
|
||||
|
||||
struct b3FeatureCache
|
||||
{
|
||||
// Read the current state of the cache.
|
||||
// Return e_unkown if neither a separation or penetration was detected.
|
||||
b3SATCacheType ReadState(const b3Transform& xf1, const b3Hull* hull1,
|
||||
const b3Transform& xf2, const b3Hull* hull2, float32 totalRadius);
|
||||
|
||||
b3SATCacheType ReadEdge(const b3Transform& xf1, const b3Hull* hull1,
|
||||
const b3Transform& xf2, const b3Hull* hull2, float32 totalRadius);
|
||||
|
||||
b3SATCacheType ReadFace(const b3Transform& xf1, const b3Hull* hull1,
|
||||
const b3Transform& xf2, const b3Hull* hull2, float32 totalRadius);
|
||||
|
||||
b3SATFeaturePair m_featurePair;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -33,45 +33,6 @@ class b3MeshShape;
|
||||
|
||||
struct b3Manifold;
|
||||
|
||||
enum b3SATCacheType
|
||||
{
|
||||
e_separation,
|
||||
e_overlap,
|
||||
e_empty,
|
||||
};
|
||||
|
||||
struct b3SATFeaturePair
|
||||
{
|
||||
enum Type
|
||||
{
|
||||
e_edge1, // an edge on hull 1 and an edge on hull 2
|
||||
e_face1, // a face on hull 1 and a vertex/edge/face on hull 2
|
||||
e_face2, // a face on hull 2 and a vertex/edge/face on hull 1
|
||||
};
|
||||
|
||||
b3SATCacheType state; // sat result
|
||||
Type type; // feature pair type
|
||||
u32 index1; // feature index on hull 1
|
||||
u32 index2; // feature index on hull 2
|
||||
};
|
||||
|
||||
struct b3FeatureCache
|
||||
{
|
||||
// Read the current state of the cache.
|
||||
// Return e_unkown if neither a separation or penetration was detected.
|
||||
b3SATCacheType ReadState(const b3Transform& xf1, const b3Hull* hull1,
|
||||
const b3Transform& xf2, const b3Hull* hull2, float32 totalRadius);
|
||||
|
||||
b3SATCacheType ReadEdge(const b3Transform& xf1, const b3Hull* hull1,
|
||||
const b3Transform& xf2, const b3Hull* hull2, float32 totalRadius);
|
||||
|
||||
b3SATCacheType ReadFace(const b3Transform& xf1, const b3Hull* hull1,
|
||||
const b3Transform& xf2, const b3Hull* hull2, float32 totalRadius);
|
||||
|
||||
// We could increase the cache size (e.g. a feature pair of the last two frames).
|
||||
b3SATFeaturePair m_featurePair;
|
||||
};
|
||||
|
||||
// A convex cache contains information used to exploit temporal
|
||||
// coherence of the contact generation algorithms between two shapes.
|
||||
struct b3ConvexCache
|
||||
|
Reference in New Issue
Block a user