16 #ifndef BT_OBB_BOX_2D_SHAPE_H 17 #define BT_OBB_BOX_2D_SHAPE_H 40 btVector3 halfExtents = getHalfExtentsWithoutMargin();
41 btVector3 margin(getMargin(), getMargin(), getMargin());
42 halfExtents += margin;
48 return m_implicitShapeDimensions;
53 btVector3 halfExtents = getHalfExtentsWithoutMargin();
54 btVector3 margin(getMargin(), getMargin(), getMargin());
55 halfExtents += margin;
58 btFsels(vec.
y(), halfExtents.
y(), -halfExtents.
y()),
59 btFsels(vec.
z(), halfExtents.
z(), -halfExtents.
z()));
64 const btVector3& halfExtents = getHalfExtentsWithoutMargin();
67 btFsels(vec.
y(), halfExtents.
y(), -halfExtents.
y()),
68 btFsels(vec.
z(), halfExtents.
z(), -halfExtents.
z()));
73 const btVector3& halfExtents = getHalfExtentsWithoutMargin();
75 for (
int i = 0; i < numVectors; i++)
79 btFsels(vec.
y(), halfExtents.
y(), -halfExtents.
y()),
80 btFsels(vec.
z(), halfExtents.
z(), -halfExtents.
z()));
100 if (minDimension > boxHalfExtents.
getY())
101 minDimension = boxHalfExtents.
getY();
104 btVector3 margin(getMargin(), getMargin(), getMargin());
105 m_implicitShapeDimensions = (boxHalfExtents * m_localScaling) - margin;
107 setSafeMargin(minDimension);
113 btVector3 oldMargin(getMargin(), getMargin(), getMargin());
114 btVector3 implicitShapeDimensionsWithMargin = m_implicitShapeDimensions + oldMargin;
117 btVector3 newMargin(getMargin(), getMargin(), getMargin());
118 m_implicitShapeDimensions = implicitShapeDimensionsWithMargin - newMargin;
122 btVector3 oldMargin(getMargin(), getMargin(), getMargin());
123 btVector3 implicitShapeDimensionsWithMargin = m_implicitShapeDimensions + oldMargin;
124 btVector3 unScaledImplicitShapeDimensionsWithMargin = implicitShapeDimensionsWithMargin / m_localScaling;
128 m_implicitShapeDimensions = (unScaledImplicitShapeDimensionsWithMargin * m_localScaling) - oldMargin;
147 return &m_vertices[0];
152 return &m_normals[0];
159 getPlaneEquation(plane, i);
161 planeSupport = localGetSupportingVertex(-planeNormal);
181 btVector3 halfExtents = getHalfExtentsWithoutMargin();
184 halfExtents.
x() * (1 - (i & 1)) - halfExtents.
x() * (i & 1),
185 halfExtents.
y() * (1 - ((i & 2) >> 1)) - halfExtents.
y() * ((i & 2) >> 1),
186 halfExtents.
z() * (1 - ((i & 4) >> 2)) - halfExtents.
z() * ((i & 4) >> 2));
191 btVector3 halfExtents = getHalfExtentsWithoutMargin();
280 getVertex(edgeVert0, pa);
281 getVertex(edgeVert1, pb);
286 btVector3 halfExtents = getHalfExtentsWithoutMargin();
290 bool result = (pt.
x() <= (halfExtents.
x() + tolerance)) &&
291 (pt.
x() >= (-halfExtents.
x() - tolerance)) &&
292 (pt.
y() <= (halfExtents.
y() + tolerance)) &&
293 (pt.
y() >= (-halfExtents.
y() - tolerance)) &&
294 (pt.
z() <= (halfExtents.
z() + tolerance)) &&
295 (pt.
z() >= (-halfExtents.
z() - tolerance));
339 #endif //BT_OBB_BOX_2D_SHAPE_H virtual bool isInside(const btVector3 &pt, btScalar tolerance) const
void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z)
virtual int getNumPlanes() const
virtual const char * getName() const
btVector3 localGetSupportingVertexWithoutMargin(const btVector3 &vec) const
virtual void getPreferredPenetrationDirection(int index, btVector3 &penetrationVector) const
virtual void getVertex(int i, btVector3 &vtx) const
const btVector3 & getCentroid() const
#define SIMD_FORCE_INLINE
const btScalar & getY() const
Return the y value.
virtual void getEdge(int i, btVector3 &pa, btVector3 &pb) const
int getVertexCount() const
const btScalar & getZ() const
Return the z value.
virtual void setMargin(btScalar margin)
const btVector3 * getVertices() const
const btScalar & x() const
Return the x value.
virtual int getNumPreferredPenetrationDirections() const
const btVector3 & getHalfExtentsWithoutMargin() const
const btScalar & y() const
Return the y value.
const btScalar & z() const
Return the z value.
The btPolyhedralConvexShape is an internal interface class for polyhedral convex shapes.
virtual void getPlane(btVector3 &planeNormal, btVector3 &planeSupport, int i) const
const btVector3 * getNormals() const
btVector3 can be used to represent 3D points and vectors.
#define ATTRIBUTE_ALIGNED16(a)
virtual void setLocalScaling(const btVector3 &scaling)
btVector3 getHalfExtentsWithMargin() const
btBox2dShape(const btVector3 &boxHalfExtents)
a btBox2dShape is a flat 2D box in the X-Y plane (Z extents are zero)
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3 *vectors, btVector3 *supportVerticesOut, int numVectors) const
#define BT_DECLARE_ALIGNED_ALLOCATOR()
virtual void setMargin(btScalar collisionMargin)
virtual int getNumEdges() const
virtual btVector3 localGetSupportingVertex(const btVector3 &vec) const
virtual void setLocalScaling(const btVector3 &scaling)
virtual void getPlaneEquation(btVector4 &plane, int i) const
const btScalar & getX() const
Return the x value.
virtual int getNumVertices() const
The btBox2dShape is a box primitive around the origin, its sides axis aligned with length specified b...
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z, const btScalar &_w)
Set x,y,z and zero w.