Commit Graph

61 Commits

Author SHA1 Message Date
Daniele Bartolini
b91124b012 Fix multi-line comment warning with -Wcomment 2019-12-15 00:41:00 +01:00
erwincoumans
49c8e738a4 propagate resultOut->m_closestPointDistanceThreshold properly for convex-convex (capsule, sphere) and convex vs plane 2018-11-27 17:31:18 -08:00
erwincoumans
ab8f16961e Code-style consistency improvement:
Apply clang-format-all.sh using the _clang-format file through all the cpp/.h files.
make sure not to apply it to certain serialization structures, since some parser expects the * as part of the name, instead of type.
This commit contains no other changes aside from adding and applying clang-format-all.sh
2018-09-23 14:17:31 -07:00
erwincoumans
5f203df65a Update btConvexConvexAlgorithm.cpp 2018-06-13 07:47:14 -07:00
erwincoumans
97c6937388 Simplify GJK. Still needs double precision for large differences of feature scales.
Extract faces directly from btConvexHullComputer (in initializePolyhedralFeatures), instead of reconstructing them, thanks to Josh Klint in #1654
PyBullet: use initializePolyhedralFeatures for convex hulls and boxes (to allow SAT)
PyBullet: expose setPhysicsEngineParameter(enableSAT=0 or 1) to enable Separating Axis Test based collision detection for convex vs convex/box and convex versus concave triangles (in a triangle mesh).
2018-06-12 16:08:46 -07:00
Stephen Sinclair
58310bd21d Fix calculation of startPt for perturbed object A.
Fixes #1563.
2018-02-16 11:57:16 -03:00
Erwin Coumans
980908bdee add optimized version of sphere-capsule and capsule-sphere, re-using the capsule-capsule code with zero height for a sphere. 2017-01-25 10:45:55 -08:00
erwincoumans
0d47d61007 pybullet getClosestPoints 2016-11-09 21:01:04 -08:00
Lunkhound
1c3686ca51 MultiThreaded Demo:
- fixing various race conditions throughout (usage of static vars, etc)
 - addition of a few lightweight mutexes (which are compiled out by default)
 - slight code rearrangement in discreteDynamicsWorld to facilitate multithreading
 - PoolAllocator::allocate() can now be called when pool is full without
     crashing (null pointer returned)
 - PoolAllocator allocate and freeMemory, are OPTIONALLY threadsafe
     (default is un-threadsafe)
 - CollisionDispatcher no longer checks if the pool allocator is full
     before calling allocate(), instead it just calls allocate() and
     checks if the return is null -- this avoids a race condition
 - SequentialImpulseConstraintSolver OPTIONALLY uses different logic in
     getOrInitSolverBody() to avoid a race condition with kinematic bodies
 - addition of 2 classes which together allow simulation islands to be run
   in parallel:
    - btSimulationIslandManagerMt
    - btDiscreteDynamicsWorldMt
 - MultiThreadedDemo example in the example browser demonstrating use of
   OpenMP, Microsoft PPL, and Intel TBB
 - use multithreading for other demos
 - benchmark demo: add parallel raycasting
2016-10-30 12:47:27 -07:00
Erwin Coumans
e2bdd7dbb1 fix more memory leaks, ImportURDFExample is now leak-free
eliminate all run-time memory allocation (except for mouse-pick/ray-intersection) in ImportURDFExample
2016-07-16 17:40:44 -07:00
erwin.coumans@gmail.com
542c53fb30 Don't pass along unused btStackAlloc everywhere. The API change might user code (derived classes with the old virtual method are not called anymore) 2013-05-08 22:45:35 +00:00
erwin.coumans
60bf599246 perform GrahamScanConvexHull2D around an arbitrary oriented 2D plane in 3D, to fix some convex hull face merging problems
add compound shape support to BulletXmlWorldImporter and fix some compile issue under Debian (hopefully)
object picking change in the demos: create a ball-socket picking constraint when holding shift while mouse dragging, otherwise a fixed (6dof) constraint
add assert in constraint solver, when both objects have their inertia tensor rows set to zero
btPolyhedralContactClipping: add edge-edge contact point in  findSeparatingAxis (similar to the default GJK case)
2012-09-28 07:14:48 +00:00
erwin.coumans
b69c6ac3f5 fix padding in btSolverConstraint, see Issue 650
fix some warnings
2012-09-08 19:21:14 +00:00
erwin.coumans
73b217fb07 Apple contribution for OSX SSE and iOS NEON optimizations unit tests, thanks to Jordan Hubbard, Ian Ollmann and Hristo Hristov.
For OSX:
cd build
./premake_osx xcode4
for iOS:
cd build
./ios_build.sh
./ios_run.sh

Also integrated the branches/StackAllocation to make it easier to multi-thread collision detection in the near future. It avoids changing the btCollisionObject while performing collision detection.

As this is a large patch, some stuff might be temporarily broken, I'll keep an eye out on issues.
2012-06-07 00:56:30 +00:00
erwin.coumans
642a6821a5 remove speculative contacts, they break restitution and cause other artifacts
use btConvexPolyhedron for debug rendering, if available
fixes in btConvexConvexAlgorithm for polyhedral contact clipping, if GJK separating normal is zero
don't shift vertices in btPolyhedralConvexShape
2011-08-30 03:28:32 +00:00
erwin.coumans
1b305562be Added Pierre Terdiman's 'internal object' optimization to improve performance for separating axis tests.
Make the winding consistent in btConvexHullComputer (and related fixes in btPolyhedralConvexShape), thanks to Ole!
Some fixes in the btPolyhedralContactClipping implementation (never report a penetration deeper than GJK/EPA found, to avoid issues due to its approximate contact normal directions)
Properly visualize btPolyhedralConvexHullShape that have a  btConvexPolyhedron (by calling initializePolyhedralFeatures() method)
2011-04-15 18:37:28 +00:00
erwin.coumans
9a9a4394ab fix in btParallelConstraintSolver to support double precision
fixes in SAT/polyhedral contact clipping, avoid adding GJK contacts (the contact margin causes different contact depths)
add polyhedral convex shape in InternalEdgeDemo as example of the new SAT/polyhedral contact clipping (added reference to Manual/what's new)
avoid glueing objecs with contacts that are positive (no gaps)
2011-04-09 03:40:15 +00:00
erwin.coumans
cdddf9d25a add FractureDemo to AllBulletDemos
improvements in CCD handling
some cleanup of CcdPhysicsDemo and BasicDemo
2011-04-09 01:14:21 +00:00
erwin.coumans
49630e9c77 improvements in separating axis test / polyhedral clipping support.
improved debug rendering for polyhedra
allow to dynamically switch between gjk and sat test to compute separating axis (independent from the polyhedral clipping)
2011-04-07 03:59:14 +00:00
erwin.coumans
2a856f8c32 add support for clipFaceAgainstHull, so we can clip convex polyhedra against triangles (without connectivity information)
in addition to the existing clipHullAgainstHull
Fix for debug drawing of contact points
comment-out some debug drawing code for triangle meshes
2011-03-29 21:58:15 +00:00
erwin.coumans
784e7fdb39 Added support for separating axis test for polyhedral shapes
Added initial support for polyhedral contact clipping. 
This clipping takes a separating normal, that can be computed using either SAT or GJK/EPA.
To enable clipping, use btPolyhedralConvexShape::initializePolyhedralFeatures(); (needs to be enabled for both convex shapes)
No concave trimesh support for SAT/clipping yet. To enable SAT, see the toggle in btConvexConvexAlgorithm.
Fixes in contact normal in btGjkPairDetector. Hopefully this doesn't cause any regression (we need unit tests!)
2011-03-29 08:52:18 +00:00
erwin.coumans
958c705a02 Demos/ConvexHullDistance/ConvexHullDistanceDemo.cpp to compile again
Allow to use convexProcessingThreshold as maximum distance for convex-convex computation (useful for closest distance/point computation)
2010-08-25 01:28:46 +00:00
erwin.coumans
788f48643b remove all warnings on Mac OSX Snow Leopard 2010-01-30 22:31:56 +00:00
erwin.coumans
8a1a509e10 fix setConvexConvexMultipointIterations feature (broken in a recent commit) 2010-01-12 03:18:49 +00:00
erwin.coumans
8444d0e5c4 Fix shapekey swapping issue with triangle meshes, see http://code.google.com/p/bullet/issues/detail?id=316
Revert btHashKeyPtr and introduce btHashPtr (to avoid breaking API/COLLADA Converter), see http://code.google.com/p/bullet/issues/detail?id=318
Disable separating distance util (it just costs CPU cycles and is disabled by default in the API anyway)
2009-12-13 15:40:21 +00:00
erwin.coumans
ed09140fb7 remove some warnings, thanks to Zenja http://bulletphysics.com/Bullet/phpBB3/viewtopic.php?f=9&t=4063 2009-09-09 23:51:30 +00:00
erwin.coumans
c6493bb049 Added specialized capsule-capsule collider. Should improve ragdoll collision performance
See also http://bulletphysics.com/Bullet/phpBB3/viewtopic.php?f=9&t=3930
To disable it, define BT_DISABLE_CAPSULE_CAPSULE_COLLIDER in the build system
2009-08-20 21:08:38 +00:00
erwin.coumans
e89fe1cbfa Make BenchmarkDemo a console application, without OpenGL/Glut dependency.
Fix potential division by zero when enabling convex distance utility.
Thanks to linzner http://code.google.com/p/bullet/issues/detail?id=264
2009-08-12 08:18:57 +00:00
erwin.coumans
3e2529fcb5 Minor constraint refactoring, to allow SPU-side processing for PLAYSTATION 3 (added non-virtual methods)
Also comment-out some code for __SPU__ to reduce code size
Added btContactConstraint (only used on PS3 SPU right now, better to use btPersistentManifold directly for contact constraints)
Improved readblend utility library (see also usage in http://gamekit.googlecode.com with Irrlicht)

Fix for btConvexConvexAlgorithm, potential division by zero
Thanks linzner http://code.google.com/p/bullet/issues/detail?id=260
2009-08-05 22:14:46 +00:00
erwin.coumans
40c73f327c + CMake build system fix under Windows: don't define _WINDOWS to allow Glut console demo to build properly
+ Allow user to enable useConvexConservativeDistanceUtil . Use dynamicsWorld->getDispatchInfo().m_useConvexConservativeDistanceUtil = true;
(see Demos/Benchmarks/Benchmark4 (convex objects falling down)
+ Fix for plane drawing (just wire-frame)
+ Gimpact: use collision margin of 0.07 for demo (because BULLET_TRIANGLE_COLLISION is used)
+ replace dot,cross,distance,angle,triple in btVector3 by btDot, btCross,btDistance,btAngle,btDistance to avoid naming conflicts
+ Some fixes in GJK penetration depth normal direction (broken in a previous commit)
+ fix in calculateDiffAxisAngleQuaternion to make ConvexConservativeDistanceUtil work properly
+ allow debug drawing to debug btContinuousConvexCollision
+ add comment/warning that btTriangleMesh::findOrAddVertex is an internal method, users should use addTriangle instead
2009-07-15 16:47:48 +00:00
erwin.coumans
badf723257 Replace all hardcoded 1e30(f) by BT_LARGE_FLOAT, defined in btScalar.h as 1e18(f) so that its square still fits in FLT_MAX
Thanks to Ole K. for reporting! http://code.google.com/p/bullet/issues/detail?id=206
2009-05-23 02:15:54 +00:00
erwin.coumans
2162f6663d disable help text by default in AllBulletDemos (text slows down many graphics cards)
improve CollisionDemo.cpp, show multi-contact generation using perturbation
improve ColladaConverter: add hinge/point 2 point constraint conversion support, add btScaledTriangleMeshShape support
Fix Dynamica MayaPlygin: remove 'active' flag, it has to be replaced by mass=0 for active, mass<>0 for passive
Added missing projectfiles
Fixed single-shot contact generation. it is disabled by default to improve performance
Bugfixes for character controller, thanks to John McCutchan for reporting
Constraint solver: better default settings
btDefaultAllocator: aligned allocator uses non-aligned allocator (instead of directly malloc/free)
disable memalign by default, use Bullet's aligned allocator
2009-02-06 03:20:43 +00:00
erwin.coumans
fd2cc88db8 contact point perturbation is work-in-progress, so disable until fully functional and tested. 2009-02-05 06:25:09 +00:00
erwin.coumans
daf350168d fix spelling mistake: pertube -> perturbe 2009-02-03 01:00:55 +00:00
erwin.coumans
0754876d77 Calculate multiple contact points (for convex-convex and convex-plane) when less then 3 points exist in the persistent manifold.
Uses the normal pertubation method, described by Gino van den Bergen:  http://www.bulletphysics.com/Bullet/phpBB3/viewtopic.php?f=4&t=288&p=888#p888
Made btRigidBody::getInvInertiaDiagLocal const, thanks to abhikp (http://code.google.com/p/bullet/issues/detail?id=183 )
2009-02-03 00:54:01 +00:00
erwin.coumans
86353f0ad8 add btActivationCollisionAlgoritm to fix deactivation problems, reported here:
http://bulletphysics.com/Bullet/phpBB3/viewtopic.php?f=9&t=2616

provide access to active objects, requested here:
http://code.google.com/p/bullet/issues/detail?id=128
2008-11-07 03:37:14 +00:00
erwin.coumans
a4c205afc0 enable convex separation util, potentially improves performance. set threshold to zero (docs follow)
fix scaling issue with btConvexHullShape
use virtual getSupportingVertex on non-SPU platform
2008-11-06 23:38:18 +00:00
erwin.coumans
bcd0f48c28 some doxygen updates, added some comments to classes, fix broken links, rename some prefix some internal GIMPACT collision structures using (for example use GIM_AABB instead of BT_AAABB),
removed obsolete btGjkEpa (it was replaced by btGjkEpa2 ages ago)
2008-11-04 04:01:31 +00:00
erwin.coumans
50930cec5c Some performance improvements and fixes related to btVector3 being aligned on SPU.
btQuantizedBvh has a version number, memory layout might be different now (due to aligned btVector3)
reorganized some data members of some classes, to reduce memory footprint
2008-10-29 02:45:43 +00:00
erwin.coumans
e6202f58ad 1)Added SCE Physics Effects boxBoxDistance
BulletMultiThreaded/NarrowPhaseCollision makes use of this boxBoxDistance.
Cache some values in src/BulletMultiThreaded/SpuContactManifoldCollisionAlgorithm.cpp, to avoid DMA transfers

2) Added btConvexSeparatingDistanceUtil: this allows caching of separating distance/vector as early-out to avoid convex-convex collision detection.
btConvexSeparatingDistanceUtil is used in src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp and can be controlled by btDispatcherInfo.m_useConvexConservativeDistanceUtil/m_convexConservativeDistanceThreshold

3) Use BulletMultiThreaded/vectormath/scalar/cpp/vectormath/scalar/cpp/vectormath_aos.h as fallback for non-PlayStation 3 Cell SPU/PPU platforms (used by boxBoxDistance).
Note there are other implementations in Extras/vectormath folder, that are potentially faster for IBM Cell SDK 3.0 SPU (libspe2)
2008-10-20 20:12:39 +00:00
erwin.coumans
883d3278ec + fixed btMinkowskiSumShape Sa+b(v) = Sa(v)-Sb(-v) instead of Sa(v)+Sb(v)
+ fix related btMinkowskiSumShape issue in btSubsimplexConvexCast and btGjkConvexCast
+ add hitpoint for btSubsimplexConvexCast
+ reduce maximum number of iterations in conservative advancement/CCD implementations
2008-04-03 18:35:28 +00:00
erwin.coumans
65bb612598 - added quickSort to btAlignedObjectArray (has generally better performance then heapSort)
- replaced all usage of heapSort by quickSort
- finished btMultiSapBroadphase. Still some work to be done to increase performance (faster add/remove from child broadphases. 
  uses currently AABB tree to locate child broadphase (should use grid), and sorted array takes too much time.
2008-03-16 04:30:43 +00:00
ejcoumans
ec76f2e0a3 - keep track of all memory allocations (gNumAllignedAllocs/gNumAllignedFree)
All memory allocations in Bullet go through btAlignedAlloc/btAlignedFree
Fix in hinge constraint constructors, thanks Marcus Hennix!
2007-10-22 22:23:10 +00:00
ejcoumans
0405ce278a use size_t instead of int, for allocator
added hashtable based PairManager, thanks Pierre Terdiman and Erin Catto
improved friction in 'cachefriendly' solver
moved 'refreshcontactpoints' into collision detection, instead of solver
avoid linear search for contact manifolds, by storing an index
ignore margin for sphere shape (its entire radius is already margin)
avoid alignment checks in BVH serialization, they don't compile on 64-bit architectures
made 'bomb' box more heavy
2007-10-11 03:17:54 +00:00
ejcoumans
bc3f9535ad cleaned up, removed warning under MSVC2005 (Level 4)
Mostly related to alignment and unused variables
2007-04-13 01:37:21 +00:00
ejcoumans
8fd8a85eee fixed memory leak, thanks AshMcConnell for reporting!
http://continuousphysics.com/Bullet/phpBB2/viewtopic.php?t=1009
2007-03-06 16:44:22 +00:00
ejcoumans
df9230327c Contribution to add optional double precision floating point support. Define BT_USE_DOUBLE_PRECISION for all involved libraries/apps. 2006-12-16 05:51:30 +00:00
ejcoumans
df0c044228 removed obsolete code, added #ifdef to allow skipping of default registration of collision algorithm (avoid linking of unneeded code) 2006-12-13 22:44:20 +00:00
ejcoumans
6738ed329d ASSERT -> btAssert
Added btStackAlloc to Bullet (right now only used by btGjkEpa)
removed default constructors of btCollisionWorld/btDiscreteDynamicsWorld, to reduce link-time dependencies
2006-11-29 01:52:09 +00:00
sjbaker
04d41b7a0a Cleanup compilation warnings. 2008-02-12 04:22:31 +00:00