about Convex Decomposition

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

about Convex Decomposition

Postby smallping » Fri Jul 02, 2010 10:15 am

I am a new beginner using newton dynamics.

And I want to use compound collision, so I must use convex decomposition for my concave models.

My models are *.obj file format coming from CAD system.

I read some articles about this in this forum, but I do not find any information I can realize it.

Can somebody help me to explain how to realize it ?

My email is : goodglxpj@hotmail.com

Thank you very much.
smallping
 
Posts: 4
Joined: Fri Jun 25, 2010 1:47 pm

Re: about Convex Decomposition

Postby Julio Jerez » Fri Jul 02, 2010 2:01 pm

what are you doing?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: about Convex Decomposition

Postby smallping » Fri Jul 02, 2010 3:22 pm

I want to use compound collision in Newton Dynamics.
Because my models are concave shape.
So I must use convex decomposition.

Can somebody give me some help about convex decompositon.
smallping
 
Posts: 4
Joined: Fri Jun 25, 2010 1:47 pm

Re: about Convex Decomposition

Postby JernejL » Fri Jul 02, 2010 3:45 pm

this can get you started, i used this library a while ago: http://codesuppository.blogspot.com/200 ... ition.html
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: about Convex Decomposition

Postby Julio Jerez » Fri Jul 02, 2010 3:46 pm

There is not convex decompsition in newton at this time. I promise I will add it to the NewtonMesh, but as of today it is an unfinished work in progress.

I beleive people use (Delfi) a free public utility that create the decomposition, you can problebly use that and feed the output data to the Compound collision in Newton.
Other than that, another solution if you do not want to go though the problem of getting different APPs just to get the collison modelled.
is to use a Physics library that already does Convex decomposition an uses polygon soup collision.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: about Convex Decomposition

Postby JernejL » Fri Jul 02, 2010 6:46 pm

I did make http://mathpudding.com/temp/extconvex.rar library, but it only comes with a delphi example - which is very simple that it could be translated to C/C++ by anyone:

Code: Select all
program ExtConvex;

uses
  sysutils;

{$R *.res}

procedure convexify(a, depth, cpercent, ppercent, maxv, skinWidth: integer; filen: PChar); cdecl; external 'DecomposeSample.dll';

begin
if fileexists(ParamStr(6)) = false then exit;

convexify(0, strtoint(ParamStr(1)), strtoint(ParamStr(2)), strtoint(ParamStr(3)),
strtoint(ParamStr(4)), strtoint(ParamStr(5)), pchar(ParamStr(6)));

end.


This is all i have, but smallping doesn't seem to understand it and i can't translate it to c for him to use (he asked me in a private message), since i don't work with c++ :(

Anyway, if he doesn't understand that pascal syntax the ratchliff's original code would be probably easier for him to use directly..
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: about Convex Decomposition

Postby Carli » Sat Jul 03, 2010 4:56 am

Delfi wrote:I did make http://mathpudding.com/temp/extconvex.rar library, but it only comes with a delphi example - which is very simple that it could be translated to C/C++ by anyone:

Code: Select all
program ExtConvex;

uses
  sysutils;

{$R *.res}

procedure convexify(a, depth, cpercent, ppercent, maxv, skinWidth: integer; filen: PChar); cdecl; external 'DecomposeSample.dll';

begin
if fileexists(ParamStr(6)) = false then exit;

convexify(0, strtoint(ParamStr(1)), strtoint(ParamStr(2)), strtoint(ParamStr(3)),
strtoint(ParamStr(4)), strtoint(ParamStr(5)), pchar(ParamStr(6)));

end.


This is all i have, but smallping doesn't seem to understand it and i can't translate it to c for him to use (he asked me in a private message), since i don't work with c++ :(

Anyway, if he doesn't understand that pascal syntax the ratchliff's original code would be probably easier for him to use directly..


I translate for you:
Code: Select all
typedef void cdecl (*Tconvexify)(int a, int depth, int cpercent, int ppercent, int maxv, int skinWidth, char* filen); // type definition of the function signature
Tconvexify convexify; // the function as a variable
unsigned int dll = LoadLibrary("DecomposeSample.dll"); // load the DLL
convexify = (Tconfexify) GetProcAddress(dll, "convexify"); // load the function


c++ is weird because you cannot link dynamic libraries platform independend but in a world of fences and walls, you will need windows and gates ;)
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron