updated EPA,
updated user manual (work in progress)
This commit is contained in:
Binary file not shown.
@@ -193,11 +193,15 @@ void DemoApplication::stepBack()
|
|||||||
}
|
}
|
||||||
void DemoApplication::zoomIn()
|
void DemoApplication::zoomIn()
|
||||||
{
|
{
|
||||||
m_cameraDistance -= 1; updateCamera();
|
m_cameraDistance -= 0.4; updateCamera();
|
||||||
|
if (m_cameraDistance < 0.1)
|
||||||
|
m_cameraDistance = 0.1;
|
||||||
|
|
||||||
}
|
}
|
||||||
void DemoApplication::zoomOut()
|
void DemoApplication::zoomOut()
|
||||||
{
|
{
|
||||||
m_cameraDistance += 1; updateCamera();
|
m_cameraDistance += 0.4; updateCamera();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,50 +16,71 @@ subject to the following restrictions:
|
|||||||
#include "btConeShape.h"
|
#include "btConeShape.h"
|
||||||
#include "LinearMath/btPoint3.h"
|
#include "LinearMath/btPoint3.h"
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
static int coneindices[3] = {1,2,0};
|
|
||||||
#else
|
|
||||||
static int coneindices[3] = {2,1,0};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
btConeShape::btConeShape (btScalar radius,btScalar height):
|
btConeShape::btConeShape (btScalar radius,btScalar height):
|
||||||
m_radius (radius),
|
m_radius (radius),
|
||||||
m_height(height)
|
m_height(height)
|
||||||
{
|
{
|
||||||
|
setConeUpIndex(1);
|
||||||
btVector3 halfExtents;
|
btVector3 halfExtents;
|
||||||
m_sinAngle = (m_radius / sqrt(m_radius * m_radius + m_height * m_height));
|
m_sinAngle = (m_radius / sqrt(m_radius * m_radius + m_height * m_height));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///choose upAxis index
|
||||||
|
void btConeShape::setConeUpIndex(int upIndex)
|
||||||
|
{
|
||||||
|
switch (upIndex)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
m_coneIndices[0] = 1;
|
||||||
|
m_coneIndices[1] = 0;
|
||||||
|
m_coneIndices[2] = 2;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
m_coneIndices[0] = 0;
|
||||||
|
m_coneIndices[1] = 1;
|
||||||
|
m_coneIndices[2] = 2;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
m_coneIndices[0] = 0;
|
||||||
|
m_coneIndices[1] = 2;
|
||||||
|
m_coneIndices[2] = 1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
assert(0);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
btVector3 btConeShape::coneLocalSupport(const btVector3& v) const
|
btVector3 btConeShape::coneLocalSupport(const btVector3& v) const
|
||||||
{
|
{
|
||||||
|
|
||||||
float halfHeight = m_height * 0.5f;
|
float halfHeight = m_height * 0.5f;
|
||||||
|
|
||||||
if (v[coneindices[1]] > v.length() * m_sinAngle)
|
if (v[m_coneIndices[1]] > v.length() * m_sinAngle)
|
||||||
{
|
{
|
||||||
btVector3 tmp;
|
btVector3 tmp;
|
||||||
|
|
||||||
tmp[coneindices[0]] = 0.f;
|
tmp[m_coneIndices[0]] = 0.f;
|
||||||
tmp[coneindices[1]] = halfHeight;
|
tmp[m_coneIndices[1]] = halfHeight;
|
||||||
tmp[coneindices[2]] = 0.f;
|
tmp[m_coneIndices[2]] = 0.f;
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
btScalar s = btSqrt(v[coneindices[0]] * v[coneindices[0]] + v[coneindices[2]] * v[coneindices[2]]);
|
btScalar s = btSqrt(v[m_coneIndices[0]] * v[m_coneIndices[0]] + v[m_coneIndices[2]] * v[m_coneIndices[2]]);
|
||||||
if (s > SIMD_EPSILON) {
|
if (s > SIMD_EPSILON) {
|
||||||
btScalar d = m_radius / s;
|
btScalar d = m_radius / s;
|
||||||
btVector3 tmp;
|
btVector3 tmp;
|
||||||
tmp[coneindices[0]] = v[coneindices[0]] * d;
|
tmp[m_coneIndices[0]] = v[m_coneIndices[0]] * d;
|
||||||
tmp[coneindices[1]] = -halfHeight;
|
tmp[m_coneIndices[1]] = -halfHeight;
|
||||||
tmp[coneindices[2]] = v[coneindices[2]] * d;
|
tmp[m_coneIndices[2]] = v[m_coneIndices[2]] * d;
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
btVector3 tmp;
|
btVector3 tmp;
|
||||||
tmp[coneindices[0]] = 0.f;
|
tmp[m_coneIndices[0]] = 0.f;
|
||||||
tmp[coneindices[1]] = -halfHeight;
|
tmp[m_coneIndices[1]] = -halfHeight;
|
||||||
tmp[coneindices[2]] = 0.f;
|
tmp[m_coneIndices[2]] = 0.f;
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ subject to the following restrictions:
|
|||||||
#include "btConvexShape.h"
|
#include "btConvexShape.h"
|
||||||
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
|
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
|
||||||
|
|
||||||
/// implements cone shape interface
|
///btConeShape implements a Cone shape, around the Y axis
|
||||||
class btConeShape : public btConvexShape
|
class btConeShape : public btConvexShape
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -27,7 +27,7 @@ class btConeShape : public btConvexShape
|
|||||||
float m_sinAngle;
|
float m_sinAngle;
|
||||||
float m_radius;
|
float m_radius;
|
||||||
float m_height;
|
float m_height;
|
||||||
|
int m_coneIndices[3];
|
||||||
btVector3 coneLocalSupport(const btVector3& v) const;
|
btVector3 coneLocalSupport(const btVector3& v) const;
|
||||||
|
|
||||||
|
|
||||||
@@ -76,8 +76,28 @@ public:
|
|||||||
{
|
{
|
||||||
return "Cone";
|
return "Cone";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///choose upAxis index
|
||||||
|
void setConeUpIndex(int upIndex);
|
||||||
|
|
||||||
|
int getConeUpIndex() const
|
||||||
|
{
|
||||||
|
return m_coneIndices[1];
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
///btConeShape implements a Cone shape, around the X axis
|
||||||
|
class btConeShapeX : public btConeShape
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
btConeShapeX(btScalar radius,btScalar height);
|
||||||
|
};
|
||||||
|
|
||||||
|
///btConeShapeZ implements a Cone shape, around the Z axis
|
||||||
|
class btConeShapeZ : public btConeShape
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
btConeShapeZ(btScalar radius,btScalar height);
|
||||||
|
};
|
||||||
#endif //CONE_MINKOWSKI_H
|
#endif //CONE_MINKOWSKI_H
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -38,6 +38,8 @@ struct sResults
|
|||||||
btVector3 witnesses[2];
|
btVector3 witnesses[2];
|
||||||
btVector3 normal;
|
btVector3 normal;
|
||||||
btScalar depth;
|
btScalar depth;
|
||||||
|
int epa_iterations;
|
||||||
|
int gjk_iterations;
|
||||||
};
|
};
|
||||||
static bool Collide(btConvexShape* shape0,const btTransform& wtrs0,
|
static bool Collide(btConvexShape* shape0,const btTransform& wtrs0,
|
||||||
btConvexShape* shape1,const btTransform& wtrs1,
|
btConvexShape* shape1,const btTransform& wtrs1,
|
||||||
|
|||||||
Reference in New Issue
Block a user