99template <
typename T,
typename Q>
109template <
typename T,
typename Q>
190#define USE_NEW_CONVEX_HULL_COMPUTER
191#ifdef USE_NEW_CONVEX_HULL_COMPUTER
194 int count = vertices.
size();
198 for (
int i=0;i<
computer.faces.size();i++)
210 int v2 =
edge->getTargetVertex();
225 add(
hres.m_OutputVertices,-center);
227 add(
hres.m_OutputVertices,center);
339 const btVector3 x[]={
t.m_n[0]->m_x,
t.m_n[1]->m_x,
t.m_n[2]->m_x,
t.m_n[3]->m_x};
340 const btVector3 c=(x[0]+x[1]+x[2]+x[3])/4;
464 drawTree(
idraw,psb->
m_ndbvt.
m_root,0,
btVector3(1,0,1),
btVector3(1,1,1),
mindepth,maxdepth);
473 drawTree(
idraw,psb->
m_fdbvt.
m_root,0,
btVector3(0,1,0),
btVector3(1,0,0),
mindepth,maxdepth);
482 drawTree(
idraw,psb->
m_cdbvt.
m_root,0,
btVector3(0,1,1),
btVector3(1,0,0),
mindepth,maxdepth);
534#define REOP_NOT_DEPENDENT -1
535#define REOP_NODE_COMPLETE -2
561 for (i=0; i <
nNodes+1; i++) {
564 for (i=0; i <
nLinks; i++) {
570 for (i=0; i <
nLinks; i++) {
713#define IDX(_x_,_y_) ((_y_)*rx+(_x_))
860#define IDX(_x_,_y_) ((_y_)*rx+(_x_))
998 for(
int j=i;
j;p*=0.5,
j>>=1)
if(
j&1)
t+=p;
1008 Hammersley::Generate(&
vtx[0],
vtx.size());
1009 for(
int i=0;i<
vtx.size();++i)
1043#define IDX(_x_,_y_) ((_y_)*maxidx+(_x_))
1044 for(
int j=2,
k=0;
k<3;
j=
k++)
1057 if (randomizeConstraints)
1067 int nvertices,
bool randomizeConstraints)
1075 &
hres.m_OutputVertices[0],0);
1076 for(
int i=0;i<(
int)
hres.mNumFaces;++i)
1078 const int idx[]={
static_cast<int>(
hres.m_Indices[i*3+0]),
1079 static_cast<int>(
hres.m_Indices[i*3+1]),
1080 static_cast<int>(
hres.m_Indices[i*3+2])};
1087 if (randomizeConstraints)
1135for(
int i=0;i<
pos.size();++i)
1140 sscanf(node,
"%d %f %f %f",&index,&x,&y,&z);
1162 for(
int i=0;i<
nface;++i)
1190 for(
int i=0;i<
ntetra;++i)
const T & btMax(const T &a, const T &b)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
btScalar btSqrt(btScalar y)
btScalar btSin(btScalar x)
btScalar btCos(btScalar x)
static T average(const btAlignedObjectArray< T > &items)
#define REOP_NODE_COMPLETE
static void drawTree(btIDebugDraw *idraw, const btDbvtNode *node, int depth, const btVector3 &ncolor, const btVector3 &lcolor, int mindepth, int maxdepth)
static void mul(btAlignedObjectArray< T > &items, const Q &value)
static int nextLine(const char *buffer)
static void add(btAlignedObjectArray< T > &items, const Q &value)
static T sum(const btAlignedObjectArray< T > &items)
static void drawBox(btIDebugDraw *idraw, const btVector3 &mins, const btVector3 &maxs, const btVector3 &color)
#define REOP_NOT_DEPENDENT
static void drawVertex(btIDebugDraw *idraw, const btVector3 &x, btScalar s, const btVector3 &c)
btSoftBodyHelpers.cpp by Nathanael Presson
LinkDeps_t * LinkDepsPtr_t
btScalar btDot(const btVector3 &v1, const btVector3 &v2)
Return the dot product between two vectors.
btVector3 btCross(const btVector3 &v1, const btVector3 &v2)
Return the cross product of two vectors.
btVector3 lerp(const btVector3 &v1, const btVector3 &v2, const btScalar &t)
Return the linear interpolation between two vectors.
The HullLibrary class can create a convex hull from a collection of vertices, using the ComputeHull m...
HullError CreateConvexHull(const HullDesc &desc, HullResult &result)
The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods It...
int size() const
return the number of elements in the array
void resize(int newsize, const T &fillData=T())
btTransform & getWorldTransform()
const Edge * getNextEdgeOfFace() const
int getSourceVertex() const
Convex hull implementation based on Preparata and Hong See http://code.google.com/p/bullet/issues/det...
The btIDebugDraw interface class allows hooking up a debug renderer to visually debug simulations.
The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with...
The btSoftBody is an class to simulate cloth and volumetric soft bodies.
void appendFace(int model=-1, Material *mat=0)
void setMass(int node, btScalar mass)
void appendTetra(int model, Material *mat)
tRContactArray m_rcontacts
void randomizeConstraints()
void appendLink(int model=-1, Material *mat=0)
btVector3 can be used to represent 3D points and vectors.
int minAxis() const
Return the axis with the smallest value Note return values are 0,1,2 for x, y, or z.
btVector3 normalized() const
Return a normalized version of this vector.
DBVT_INLINE btVector3 Extents() const
DBVT_INLINE btVector3 Center() const
DBVT_INLINE bool isinternal() const
DBVT_INLINE bool isleaf() const
static btSoftBody * CreatePatchUV(btSoftBodyWorldInfo &worldInfo, const btVector3 &corner00, const btVector3 &corner10, const btVector3 &corner01, const btVector3 &corner11, int resx, int resy, int fixeds, bool gendiags, float *tex_coords=0)
static btSoftBody * CreateFromTriMesh(btSoftBodyWorldInfo &worldInfo, const btScalar *vertices, const int *triangles, int ntriangles, bool randomizeConstraints=true)
static void DrawNodeTree(btSoftBody *psb, btIDebugDraw *idraw, int mindepth=0, int maxdepth=-1)
static btSoftBody * CreateFromTetGenData(btSoftBodyWorldInfo &worldInfo, const char *ele, const char *face, const char *node, bool bfacelinks, bool btetralinks, bool bfacesfromtetras)
static btSoftBody * CreateFromConvexHull(btSoftBodyWorldInfo &worldInfo, const btVector3 *vertices, int nvertices, bool randomizeConstraints=true)
static btSoftBody * CreatePatch(btSoftBodyWorldInfo &worldInfo, const btVector3 &corner00, const btVector3 &corner10, const btVector3 &corner01, const btVector3 &corner11, int resx, int resy, int fixeds, bool gendiags)
static void ReoptimizeLinkOrder(btSoftBody *psb)
Sort the list of links to move link calculations that are dependent upon earlier ones as far as possi...
static void DrawFaceTree(btSoftBody *psb, btIDebugDraw *idraw, int mindepth=0, int maxdepth=-1)
static void DrawInfos(btSoftBody *psb, btIDebugDraw *idraw, bool masses, bool areas, bool stress)
static btSoftBody * CreateEllipsoid(btSoftBodyWorldInfo &worldInfo, const btVector3 ¢er, const btVector3 &radius, int res)
static void DrawClusterTree(btSoftBody *psb, btIDebugDraw *idraw, int mindepth=0, int maxdepth=-1)
static float CalculateUV(int resx, int resy, int ix, int iy, int id)
static void Draw(btSoftBody *psb, btIDebugDraw *idraw, int drawflags=fDrawFlags::Std)
static void DrawFrame(btSoftBody *psb, btIDebugDraw *idraw)
static btSoftBody * CreateRope(btSoftBodyWorldInfo &worldInfo, const btVector3 &from, const btVector3 &to, int res, int fixeds)
btAlignedObjectArray< Node * > m_nodes