17 #ifndef BT_IDEBUG_DRAW__H
18 #define BT_IDEBUG_DRAW__H
74 drawSpherePatch(center, up, axis, radius,minTh, maxTh, minPs, maxPs, color, stepDegrees ,
false);
75 drawSpherePatch(center, up, -axis, radius,minTh, maxTh, minPs, maxPs, color, stepDegrees,
false );
119 pa =
btVector3(edgecoord[0]*halfExtents[0], edgecoord[1]*halfExtents[1],
120 edgecoord[2]*halfExtents[2]);
123 int othercoord = j%3;
124 edgecoord[othercoord]*=-1.f;
125 pb =
btVector3(edgecoord[0]*halfExtents[0], edgecoord[1]*halfExtents[1],
126 edgecoord[2]*halfExtents[2]);
150 int nSteps = (int)((maxAngle - minAngle) / step);
151 if(!nSteps) nSteps = 1;
157 for(
int i = 1; i <= nSteps; i++)
198 drawN = drawS =
true;
200 int n_hor = (int)((maxTh - minTh) / step) + 1;
201 if(n_hor < 2) n_hor = 2;
203 bool isClosed =
false;
218 int n_vert = (int)((maxPs - minPs) / step) + 1;
219 if(n_vert < 2) n_vert = 2;
221 for(
int i = 0; i < n_hor; i++)
226 for(
int j = 0; j < n_vert; j++)
231 pvB[j] = center + cth * cps * iv + cth * sps * jv + sth * kv;
248 if((i == (n_hor - 1)) && drawN)
264 if(((!i) || (i == (n_hor-1))) && ((!j) || (j == (n_vert-1))))
271 pT = pvA; pvA = pvB; pvB = pT;
309 int stepDegrees = 30;
312 capStart[upAxis] = -halfHeight;
315 capEnd[upAxis] = halfHeight;
321 childTransform.
getOrigin() = transform * capStart;
331 drawSpherePatch(center, up, axis, radius,minTh, maxTh, minPs, maxPs, color,
btScalar(stepDegrees) ,
false);
340 childTransform.
getOrigin() = transform * capEnd;
349 drawSpherePatch(center, up, axis, radius,minTh, maxTh, minPs, maxPs, color,
btScalar(stepDegrees) ,
false);
356 for (
int i=0;i<360;i+=stepDegrees)
359 capEnd[(upAxis+2)%3] = capStart[(upAxis+2)%3] =
btCos(
btScalar(i)*SIMD_RADS_PER_DEG)*radius;
369 offsetHeight[upAxis] = halfHeight;
372 capStart[upAxis] = -halfHeight;
374 capEnd[upAxis] = halfHeight;
376 for (
int i=0;i<360;i+=stepDegrees)
379 capEnd[(upAxis+2)%3] = capStart[(upAxis+2)%3] =
btCos(
btScalar(i)*SIMD_RADS_PER_DEG)*radius;
386 xaxis[(upAxis+1)%3] =
btScalar(1.0);
393 int stepDegrees = 30;
398 offsetHeight[upAxis] = halfHeight;
400 offsetRadius[(upAxis+1)%3] = radius;
402 offset2Radius[(upAxis+2)%3] = radius;
406 capEnd[upAxis] = -halfHeight;
408 for (
int i=0;i<360;i+=stepDegrees)
415 drawLine(start+transform.
getBasis() * (offsetHeight),start+transform.
getBasis() * (-offsetHeight+offsetRadius),color);
416 drawLine(start+transform.
getBasis() * (offsetHeight),start+transform.
getBasis() * (-offsetHeight-offsetRadius),color);
417 drawLine(start+transform.
getBasis() * (offsetHeight),start+transform.
getBasis() * (-offsetHeight+offset2Radius),color);
418 drawLine(start+transform.
getBasis() * (offsetHeight),start+transform.
getBasis() * (-offsetHeight-offset2Radius),color);
424 xaxis[(upAxis+1)%3] =
btScalar(1.0);
430 btVector3 planeOrigin = planeNormal * planeConst;
434 btVector3 pt0 = planeOrigin + vec0*vecLen;
435 btVector3 pt1 = planeOrigin - vec0*vecLen;
436 btVector3 pt2 = planeOrigin + vec1*vecLen;
437 btVector3 pt3 = planeOrigin - vec1*vecLen;
438 drawLine(transform*pt0,transform*pt1,color);
439 drawLine(transform*pt2,transform*pt3,color);
444 #endif //BT_IDEBUG_DRAW__H
virtual void drawBox(const btVector3 &bbMin, const btVector3 &bbMax, const btTransform &trans, const btVector3 &color)
virtual void drawSphere(const btVector3 &p, btScalar radius, const btVector3 &color)
btScalar btSin(btScalar x)
virtual void reportErrorWarning(const char *warningString)=0
virtual void drawLine(const btVector3 &from, const btVector3 &to, const btVector3 &color)=0
virtual void drawTriangle(const btVector3 &v0, const btVector3 &v1, const btVector3 &v2, const btVector3 &color, btScalar)
virtual void drawBox(const btVector3 &bbMin, const btVector3 &bbMax, const btVector3 &color)
void btPlaneSpace1(const T &n, T &p, T &q)
virtual void drawPlane(const btVector3 &planeNormal, btScalar planeConst, const btTransform &transform, const btVector3 &color)
virtual void drawArc(const btVector3 ¢er, const btVector3 &normal, const btVector3 &axis, btScalar radiusA, btScalar radiusB, btScalar minAngle, btScalar maxAngle, const btVector3 &color, bool drawSect, btScalar stepDegrees=btScalar(10.f))
btVector3 getColumn(int i) const
Get a column of the matrix as a vector.
virtual void drawCapsule(btScalar radius, btScalar halfHeight, int upAxis, const btTransform &transform, const btVector3 &color)
virtual void drawContactPoint(const btVector3 &PointOnB, const btVector3 &normalOnB, btScalar distance, int lifeTime, const btVector3 &color)=0
virtual void drawSpherePatch(const btVector3 ¢er, const btVector3 &up, const btVector3 &axis, btScalar radius, btScalar minTh, btScalar maxTh, btScalar minPs, btScalar maxPs, const btVector3 &color, btScalar stepDegrees=btScalar(10.f), bool drawCenter=true)
virtual void draw3dText(const btVector3 &location, const char *textString)=0
virtual void drawCone(btScalar radius, btScalar height, int upAxis, const btTransform &transform, const btVector3 &color)
btVector3 cross(const btVector3 &v) const
Return the cross product between this and another vector.
The btIDebugDraw interface class allows hooking up a debug renderer to visually debug simulations...
virtual void drawAabb(const btVector3 &from, const btVector3 &to, const btVector3 &color)
btVector3 can be used to represent 3D points and vectors.
virtual void drawTriangle(const btVector3 &v0, const btVector3 &v1, const btVector3 &v2, const btVector3 &, const btVector3 &, const btVector3 &, const btVector3 &color, btScalar alpha)
virtual void drawTransform(const btTransform &transform, btScalar orthoLen)
virtual int getDebugMode() const =0
virtual void setDebugMode(int debugMode)=0
virtual void drawSphere(btScalar radius, const btTransform &transform, const btVector3 &color)
virtual void drawLine(const btVector3 &from, const btVector3 &to, const btVector3 &fromColor, const btVector3 &toColor)
#define SIMD_RADS_PER_DEG
virtual void drawCylinder(btScalar radius, btScalar halfHeight, int upAxis, const btTransform &transform, const btVector3 &color)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
btScalar btCos(btScalar x)