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;
47 const btVector3& getHalfExtentsWithoutMargin()
const
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()));
73 virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(
const btVector3* vectors,
btVector3* supportVerticesOut,
int numVectors)
const
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;
146 int getVertexCount()
const
151 virtual int getNumVertices()
const
158 return &m_vertices[0];
163 return &m_normals[0];
176 getPlaneEquation(plane,i);
178 planeSupport = localGetSupportingVertex(-planeNormal);
187 virtual int getNumPlanes()
const
194 virtual int getNumEdges()
const
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));
211 virtual void getPlaneEquation(
btVector4& plane,
int i)
const
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));
330 virtual const char* getName()
const
335 virtual int getNumPreferredPenetrationDirections()
const
340 virtual void getPreferredPenetrationDirection(
int index,
btVector3& penetrationVector)
const
369 #endif //BT_OBB_BOX_2D_SHAPE_H