fix mesh size, decouple mesh topology from geometry, add polygon triangulation to make mass calculation O(n) in memory

This commit is contained in:
Irlan
2017-02-02 14:02:54 -02:00
parent 4f18e46268
commit d59b67c3c3
5 changed files with 158 additions and 156 deletions

View File

@@ -22,43 +22,6 @@
#include <bounce/common/math/math.h>
#include <bounce/common/math/transform.h>
// A triangle in indexed form.
struct b3Triangle
{
// Does nothing for performance.
b3Triangle() { }
// Set this triangle from three vertices.
b3Triangle(u32 _v1, u32 _v2, u32 _v3)
{
v1 = _v1;
v2 = _v2;
v3 = _v3;
}
// Set this triangle from three vertices.
void Set(u32 _v1, u32 _v2, u32 _v3)
{
v1 = _v1;
v2 = _v2;
v3 = _v3;
}
// Test if this triangle contains a given vertex.
bool TestVertex(u32 v) const
{
return v == v1 || v == v2 || v == v3;
}
// Test if this triangle contains two vertices.
bool TestEdge(u32 _v1, u32 _v2) const
{
return TestVertex(_v1) && TestVertex(_v2);
}
u32 v1, v2, v3;
};
// A plane in constant normal form.
// dot(n, p) - d = 0.
struct b3Plane