btSoftBodyHelpers.h
Go to the documentation of this file.
00001 /*
00002 Bullet Continuous Collision Detection and Physics Library
00003 Copyright (c) 2003-2008 Erwin Coumans  http://continuousphysics.com/Bullet/
00004 
00005 This software is provided 'as-is', without any express or implied warranty.
00006 In no event will the authors be held liable for any damages arising from the use of this software.
00007 Permission is granted to anyone to use this software for any purpose, 
00008 including commercial applications, and to alter it and redistribute it freely, 
00009 subject to the following restrictions:
00010 
00011 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
00012 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
00013 3. This notice may not be removed or altered from any source distribution.
00014 */
00015 
00016 #ifndef BT_SOFT_BODY_HELPERS_H
00017 #define BT_SOFT_BODY_HELPERS_H
00018 
00019 #include "btSoftBody.h"
00020 
00021 //
00022 // Helpers
00023 //
00024 
00025 /* fDrawFlags                                                                                                                   */ 
00026 struct  fDrawFlags { enum _ {
00027         Nodes           =       0x0001,
00028         Links           =       0x0002,
00029         Faces           =       0x0004,
00030         Tetras          =       0x0008,
00031         Normals         =       0x0010,
00032         Contacts        =       0x0020,
00033         Anchors         =       0x0040,
00034         Notes           =       0x0080,
00035         Clusters        =       0x0100,
00036         NodeTree        =       0x0200,
00037         FaceTree        =       0x0400,
00038         ClusterTree     =       0x0800,
00039         Joints          =       0x1000,
00040         /* presets      */ 
00041         Std                     =       Links+Faces+Tetras+Anchors+Notes+Joints,
00042         StdTetra        =       Std-Faces+Tetras
00043 };};
00044 
00045 struct  btSoftBodyHelpers
00046 {
00047         /* Draw body                                                                                                                    */ 
00048         static void                             Draw(           btSoftBody* psb,
00049                 btIDebugDraw* idraw,
00050                 int drawflags=fDrawFlags::Std);
00051         /* Draw body infos                                                                                                              */ 
00052         static  void                    DrawInfos(      btSoftBody* psb,
00053                 btIDebugDraw* idraw,
00054                 bool masses,
00055                 bool areas,
00056                 bool stress);
00057         /* Draw node tree                                                                                                               */ 
00058         static void                             DrawNodeTree(   btSoftBody* psb,
00059                 btIDebugDraw* idraw,
00060                 int mindepth=0,
00061                 int maxdepth=-1);
00062         /* Draw face tree                                                                                                               */ 
00063         static void                             DrawFaceTree(   btSoftBody* psb,
00064                 btIDebugDraw* idraw,
00065                 int mindepth=0,
00066                 int maxdepth=-1);
00067         /* Draw cluster tree                                                                                                    */ 
00068         static void                             DrawClusterTree(btSoftBody* psb,
00069                 btIDebugDraw* idraw,
00070                 int mindepth=0,
00071                 int maxdepth=-1);
00072         /* Draw rigid frame                                                                                                             */ 
00073         static  void                    DrawFrame(              btSoftBody* psb,
00074                 btIDebugDraw* idraw);
00075         /* Create a rope                                                                                                                */ 
00076         static  btSoftBody*             CreateRope( btSoftBodyWorldInfo& worldInfo,
00077                 const btVector3& from,
00078                 const btVector3& to,
00079                 int res,
00080                 int fixeds);
00081         /* Create a patch                                                                                                               */ 
00082         static  btSoftBody*             CreatePatch(btSoftBodyWorldInfo& worldInfo,
00083                 const btVector3& corner00,
00084                 const btVector3& corner10,
00085                 const btVector3& corner01,
00086                 const btVector3& corner11,
00087                 int resx,
00088                 int resy,
00089                 int fixeds,
00090                 bool gendiags);
00091         /* Create a patch with UV Texture Coordinates   */ 
00092         static  btSoftBody*             CreatePatchUV(btSoftBodyWorldInfo& worldInfo,
00093                 const btVector3& corner00,
00094                 const btVector3& corner10,
00095                 const btVector3& corner01,
00096                 const btVector3& corner11,
00097                 int resx,
00098                 int resy,
00099                 int fixeds,
00100                 bool gendiags,
00101                 float* tex_coords=0);
00102         static  float   CalculateUV(int resx,int resy,int ix,int iy,int id);
00103         /* Create an ellipsoid                                                                                                  */ 
00104         static  btSoftBody*             CreateEllipsoid(btSoftBodyWorldInfo& worldInfo,
00105                 const btVector3& center,
00106                 const btVector3& radius,
00107                 int res);       
00108         /* Create from trimesh                                                                                                  */ 
00109         static  btSoftBody*             CreateFromTriMesh(      btSoftBodyWorldInfo& worldInfo,
00110                 const btScalar* vertices,
00111                 const int* triangles,
00112                 int ntriangles,
00113                 bool randomizeConstraints = true);
00114         /* Create from convex-hull                                                                                              */ 
00115         static  btSoftBody*             CreateFromConvexHull(   btSoftBodyWorldInfo& worldInfo,
00116                 const btVector3* vertices,
00117                 int nvertices,
00118                 bool randomizeConstraints = true);
00119 
00120 
00121         /* Export TetGen compatible .smesh file                                                                 */ 
00122 //      static void                             ExportAsSMeshFile(      btSoftBody* psb,
00123 //                                                                                              const char* filename);  
00124         /* Create from TetGen .ele, .face, .node files                                                  */ 
00125 //      static btSoftBody*              CreateFromTetGenFile(   btSoftBodyWorldInfo& worldInfo,
00126 //                                                                                                      const char* ele,
00127 //                                                                                                      const char* face,
00128 //                                                                                                      const char* node,
00129 //                                                                                                      bool bfacelinks,
00130 //                                                                                                      bool btetralinks,
00131 //                                                                                                      bool bfacesfromtetras);
00132         /* Create from TetGen .ele, .face, .node data                                                   */ 
00133         static btSoftBody*              CreateFromTetGenData(   btSoftBodyWorldInfo& worldInfo,
00134                                                                                                         const char* ele,
00135                                                                                                         const char* face,
00136                                                                                                         const char* node,
00137                                                                                                         bool bfacelinks,
00138                                                                                                         bool btetralinks,
00139                                                                                                         bool bfacesfromtetras);
00140         
00141 };
00142 
00143 #endif //BT_SOFT_BODY_HELPERS_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


bullet
Author(s): Erwin Coumans, ROS package maintained by Tully Foote
autogenerated on Wed Oct 31 2012 07:54:31