16 #ifndef BT_OBB_BOX_2D_SHAPE_H
17 #define BT_OBB_BOX_2D_SHAPE_H
41 btVector3 halfExtents = getHalfExtentsWithoutMargin();
42 btVector3 margin(getMargin(),getMargin(),getMargin());
43 halfExtents += margin;
49 return m_implicitShapeDimensions;
55 btVector3 halfExtents = getHalfExtentsWithoutMargin();
56 btVector3 margin(getMargin(),getMargin(),getMargin());
57 halfExtents += margin;
60 btFsels(vec.
y(), halfExtents.
y(), -halfExtents.
y()),
61 btFsels(vec.
z(), halfExtents.
z(), -halfExtents.
z()));
66 const btVector3& halfExtents = getHalfExtentsWithoutMargin();
69 btFsels(vec.
y(), halfExtents.
y(), -halfExtents.
y()),
70 btFsels(vec.
z(), halfExtents.
z(), -halfExtents.
z()));
75 const btVector3& halfExtents = getHalfExtentsWithoutMargin();
77 for (
int i=0;i<numVectors;i++)
81 btFsels(vec.
y(), halfExtents.
y(), -halfExtents.
y()),
82 btFsels(vec.
z(), halfExtents.
z(), -halfExtents.
z()));
90 : btPolyhedralConvexShape(),
104 if (minDimension>boxHalfExtents.
getY())
105 minDimension = boxHalfExtents.
getY();
106 setSafeMargin(minDimension);
109 btVector3 margin(getMargin(),getMargin(),getMargin());
110 m_implicitShapeDimensions = (boxHalfExtents * m_localScaling) - margin;
116 btVector3 oldMargin(getMargin(),getMargin(),getMargin());
117 btVector3 implicitShapeDimensionsWithMargin = m_implicitShapeDimensions+oldMargin;
120 btVector3 newMargin(getMargin(),getMargin(),getMargin());
121 m_implicitShapeDimensions = implicitShapeDimensionsWithMargin - newMargin;
126 btVector3 oldMargin(getMargin(),getMargin(),getMargin());
127 btVector3 implicitShapeDimensionsWithMargin = m_implicitShapeDimensions+oldMargin;
128 btVector3 unScaledImplicitShapeDimensionsWithMargin = implicitShapeDimensionsWithMargin / m_localScaling;
132 m_implicitShapeDimensions = (unScaledImplicitShapeDimensionsWithMargin * m_localScaling) - oldMargin;
158 return &m_vertices[0];
163 return &m_normals[0];
176 getPlaneEquation(plane,i);
178 planeSupport = localGetSupportingVertex(-planeNormal);
202 btVector3 halfExtents = getHalfExtentsWithoutMargin();
205 halfExtents.
x() * (1-(i&1)) - halfExtents.
x() * (i&1),
206 halfExtents.
y() * (1-((i&2)>>1)) - halfExtents.
y() * ((i&2)>>1),
207 halfExtents.
z() * (1-((i&4)>>2)) - halfExtents.
z() * ((i&4)>>2));
213 btVector3 halfExtents = getHalfExtentsWithoutMargin();
304 getVertex(edgeVert0,pa );
305 getVertex(edgeVert1,pb );
314 btVector3 halfExtents = getHalfExtentsWithoutMargin();
318 bool result = (pt.
x() <= (halfExtents.
x()+tolerance)) &&
319 (pt.
x() >= (-halfExtents.
x()-tolerance)) &&
320 (pt.
y() <= (halfExtents.
y()+tolerance)) &&
321 (pt.
y() >= (-halfExtents.
y()-tolerance)) &&
322 (pt.
z() <= (halfExtents.
z()+tolerance)) &&
323 (pt.
z() >= (-halfExtents.
z()-tolerance));
369 #endif //BT_OBB_BOX_2D_SHAPE_H
btVector3 localGetSupportingVertexWithoutMargin(const btVector3 &vec) const
virtual const char * getName() const
void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z)
#define SIMD_FORCE_INLINE
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3 *vectors, btVector3 *supportVerticesOut, int numVectors) const
const btScalar & x() const
Return the x value.
const btScalar & getZ() const
Return the z value.
virtual void setMargin(btScalar margin)
const btVector3 * getVertices() const
const btScalar & getY() const
Return the y value.
virtual bool isInside(const btVector3 &pt, btScalar tolerance) const
const btScalar & getX() const
Return the x value.
The btPolyhedralConvexShape is an internal interface class for polyhedral convex shapes.
virtual int getNumVertices() const
const btScalar & y() const
Return the y value.
btVector3 can be used to represent 3D points and vectors.
#define ATTRIBUTE_ALIGNED16(a)
virtual void setLocalScaling(const btVector3 &scaling)
btBox2dShape(const btVector3 &boxHalfExtents)
a btBox2dShape is a flat 2D box in the X-Y plane (Z extents are zero)
virtual int getNumPlanes() const
virtual int getNumPreferredPenetrationDirections() const
virtual void getVertex(int i, btVector3 &vtx) const
const btVector3 & getCentroid() const
#define BT_DECLARE_ALIGNED_ALLOCATOR()
virtual void setMargin(btScalar collisionMargin)
virtual void getPlaneEquation(btVector4 &plane, int i) const
virtual void getPlane(btVector3 &planeNormal, btVector3 &planeSupport, int i) const
int getVertexCount() const
virtual void setLocalScaling(const btVector3 &scaling)
const btVector3 & getHalfExtentsWithoutMargin() const
virtual void getEdge(int i, btVector3 &pa, btVector3 &pb) const
const btVector3 * getNormals() const
virtual int getNumEdges() const
virtual btVector3 localGetSupportingVertex(const btVector3 &vec) const
btVector3 getHalfExtentsWithMargin() 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...
virtual void getPreferredPenetrationDirection(int index, btVector3 &penetrationVector) const
void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z, const btScalar &_w)
Set x,y,z and zero w.
const btScalar & z() const
Return the z value.