Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

878000 Posts in 32898 Topics- by 24323 Members - Latest Member: nickFromPaintteh

May 21, 2013, 01:25:35 AM
TIGSource ForumsDeveloperTechnical (Moderators: Glaiel-Gamer, ThemsAllTook)Suggestions for lightweight collision detection library?
Pages: [1]
Print
Author Topic: Suggestions for lightweight collision detection library?  (Read 801 times)
akademiks
Level 0
***


View Profile
« on: February 01, 2012, 10:20:35 AM »

Hi guys,

I work on a small CAD application where all 3d objects are simple 3D convex polygons. I want to set a mode in the app where objects cannot traverse each others. Since no real physic is implicated i basically just need to call a simple collision(obj1,obj2) function.

I found a good lib called PGP (http://gamma.cs.unc.edu/SSV/) but i just found that the license is for non profit application which is not my case...
 
Logged
EdgeOfProphecy
Level 2
**



View Profile WWW Email
« Reply #1 on: February 01, 2012, 10:26:33 AM »

A few questions.

1)  How fast can objects move?
2)  How many objects need to be moving a the same time?
3)  How precise does the collision and math need to be?
4)  You said this is for a CAD program?  How would code be integrated into the project?  I'm guessing you have access to the source, but what language is it in?
Logged
akademiks
Level 0
***


View Profile
« Reply #2 on: February 01, 2012, 10:29:40 AM »


1 - Well i am not sure about how fast, i guess not that much since the speed is driven my the finger dragging.
2 - Either 1 or a ground of N objects all moving as a group
3 - It must be really accurate (support 3d convex polygons with rotations). There is also the fact that the application
has an orthographic view mode.
4 - I am looking for a C/C++ code library, ideally with source available because its an iOS project so i don't want to waste hours trying to compile the thing ...

Thx
« Last Edit: February 01, 2012, 10:36:35 AM by akademiks » Logged
EdgeOfProphecy
Level 2
**



View Profile WWW Email
« Reply #3 on: February 01, 2012, 10:31:15 AM »

Is it for smartphones?
Logged
akademiks
Level 0
***


View Profile
« Reply #4 on: February 01, 2012, 10:36:52 AM »

Yes, see my updated answer above
Logged
ThemsAllTook
Moderator
Level 8
******


Alex Diener


View Profile WWW
« Reply #5 on: February 01, 2012, 10:56:34 AM »

I'm not an expert, but I played with Newton a while back and came away with a good impression of it. At a glance, it looks like it might fit what you need.
Logged
EdgeOfProphecy
Level 2
**



View Profile WWW Email
« Reply #6 on: February 01, 2012, 10:58:34 AM »

Hmmmm, normally I'd recommend Box2D, but that's...well...2D, which won't cut it.

I think Bullet has a version for iOS.  It's an open source physics engine, and I've heard pretty good things about it.  I don't know what it would actually be like running on iOS, though.

I know it's a full on physics engine, and you're looking for just collision, but it might be scalable to your needs.  Other than Bullet, the only thing I've heard of is a detection library called coldet, but I know basically nothing about it.

http://sourceforge.net/projects/coldet/
http://bulletphysics.org/wordpress/
Logged
akademiks
Level 0
***


View Profile
« Reply #7 on: February 01, 2012, 11:07:58 AM »

Thanks for the suggestions, i will have a look at them.

For Bullet, yes its easy to include in an iOS project i did it before but like you said its a whole physic engine where you have to setup a physic world object and update it at each step etc...
Logged
BorisTheBrave
Level 10
*****


View Profile WWW
« Reply #8 on: February 01, 2012, 03:08:51 PM »

If you just have convex polytopes, then GJK is what you want. It's not that difficult to implement, but Bullet has an implementation.

If you need to support arbitrary meshes, it gets much harder. I would recommend either decomposing, or just doing an "approximate" method. Such as checking every vertex for being inside the other shape - this will work in 90% of cases.
Logged
Ivan
Owl Country
Level 10
*


alright, let's see what we can see

Valaam0
View Profile
« Reply #9 on: February 02, 2012, 01:57:34 AM »

For Bullet, you don't need to setup a physics world if you only want collisions, it has a simpler, collision-only world.
Logged

http://polycode.org/ - Free, cross-platform, open-source engine.
akademiks
Level 0
***


View Profile
« Reply #10 on: February 02, 2012, 04:47:29 AM »

Really? Could you give me more info about that?
Logged
Ivan
Owl Country
Level 10
*


alright, let's see what we can see

Valaam0
View Profile
« Reply #11 on: February 02, 2012, 10:31:26 AM »

Bullet has a class called btCollisionWorld, which is collision only, it does not simulate any physics. Here is the collision detection module from my engine which uses it. It should give you an idea about how to get started:

https://github.com/ivansafrin/Polycode/blob/master/Modules/Contents/3DPhysics/Source/PolyCollisionScene.cpp
Logged

http://polycode.org/ - Free, cross-platform, open-source engine.
Geti
Level 10
*****



View Profile WWW
« Reply #12 on: February 02, 2012, 05:00:37 PM »

If you've got all your mesh data there it could be simple enough to just write code determining if any of the edges of one shape intersect any of the faces of the others. Its not like you need distances of penetration or whatever -> a simple catch all like that would likely suit your needs. Depends if you've got the time to implement it or not, but I expect integrating a large library like bullet would probably take a similar amount of time.
Logged

Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic