18btCylinderShape::btCylinderShape(
const btVector3& halfExtents)
19 : btConvexInternalShape(),
31 : btCylinderShape(halfExtents)
37 : btCylinderShape(halfExtents)
42void btCylinderShape::getAabb(
const btTransform& t, btVector3& aabbMin, btVector3& aabbMax)
const
47void btCylinderShape::calculateLocalInertia(
btScalar mass, btVector3& inertia)
const
51#ifndef USE_BOX_INERTIA_APPROXIMATION
68 int idxRadius, idxHeight;
86 radius2 = halfExtents[idxRadius] * halfExtents[idxRadius];
87 height2 =
btScalar(4.) * halfExtents[idxHeight] * halfExtents[idxHeight];
90 btScalar t1 = div12 * height2 + div4 * radius2;
96 inertia.setValue(t2, t1, t1);
99 inertia.setValue(t1, t1, t2);
102 inertia.setValue(t1, t2, t1);
112 inertia.setValue(mass / (
btScalar(12.0)) * (ly * ly + lz * lz),
113 mass / (
btScalar(12.0)) * (lx * lx + lz * lz),
114 mass / (
btScalar(12.0)) * (lx * lx + ly * ly));
120 const int cylinderUpAxis = 0;
129 btScalar halfHeight = halfExtents[cylinderUpAxis];
139 tmp[YY] =
v[YY] < 0.0 ? -halfHeight : halfHeight;
146 tmp[YY] =
v[YY] < 0.0 ? -halfHeight : halfHeight;
154 const int cylinderUpAxis = 1;
160 btScalar halfHeight = halfExtents[cylinderUpAxis];
170 tmp[YY] =
v[YY] < 0.0 ? -halfHeight : halfHeight;
177 tmp[YY] =
v[YY] < 0.0 ? -halfHeight : halfHeight;
185 const int cylinderUpAxis = 2;
194 btScalar halfHeight = halfExtents[cylinderUpAxis];
204 tmp[YY] =
v[YY] < 0.0 ? -halfHeight : halfHeight;
211 tmp[YY] =
v[YY] < 0.0 ? -halfHeight : halfHeight;
226btVector3 btCylinderShape::localGetSupportingVertexWithoutMargin(
const btVector3& vec)
const
231void btCylinderShape::batchedUnitVectorGetSupportingVertexWithoutMargin(
const btVector3* vectors, btVector3* supportVerticesOut,
int numVectors)
const
233 for (
int i = 0; i < numVectors; i++)
241 for (
int i = 0; i < numVectors; i++)
249 for (
int i = 0; i < numVectors; i++)
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE void btTransformAabb(const btVector3 &halfExtents, btScalar margin, const btTransform &t, btVector3 &aabbMinOut, btVector3 &aabbMaxOut)
const btVector3 & getHalfExtentsWithoutMargin() const
btVector3 getHalfExtentsWithMargin() const
@ CYLINDER_SHAPE_PROXYTYPE
virtual btScalar getMargin() const =0
void setSafeMargin(btScalar minDimension, btScalar defaultMarginMultiplier=0.1f)
btVector3 m_implicitShapeDimensions
btVector3 CylinderLocalSupportZ(const btVector3 &halfExtents, const btVector3 &v)
btVector3 CylinderLocalSupportY(const btVector3 &halfExtents, const btVector3 &v)
SIMD_FORCE_INLINE btVector3 CylinderLocalSupportX(const btVector3 &halfExtents, const btVector3 &v)
const btVector3 & getHalfExtentsWithoutMargin() const
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
SIMD_FORCE_INLINE btScalar btSqrt(btScalar y)
#define SIMD_FORCE_INLINE
btCylinderShapeX(const btVector3 &halfExtents)
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3 &vec) const
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3 *vectors, btVector3 *supportVerticesOut, int numVectors) const
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3 *vectors, btVector3 *supportVerticesOut, int numVectors) const
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3 &vec) const
btCylinderShapeZ(const btVector3 &halfExtents)