Scaling API changes?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Scaling API changes?

Postby pHySiQuE » Sun Mar 25, 2012 6:36 pm

It looks like the ConvexHullModifier class is no longer being used in the latest version of the code in the repository. Can you tell us anything about how the new scaling features work, or is it too soon? Thanks!
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Scaling API changes?

Postby Julio Jerez » Sun Mar 25, 2012 7:26 pm

Yes, I said before convexhullmodifier, and elipsoid collision are going the way of the dodo.
There are not needed because Collison Instance is a superior solution.
I just completed the basic collision intances, but I have not enable scaling yet.
basicilly now all collisions shape will support non uniform scale and arbitrary matrix.

Now that I completed the intances base functionality this week I will going adding the scaling.

Bascially I will work like this:

collison->SetScale (x, y, z);
collison->SetMatrix (matrix);
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Scaling API changes?

Postby pHySiQuE » Sun Mar 25, 2012 9:57 pm

Awesome! Do we need to code any differently, or is this just an internal design thing?
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Scaling API changes?

Postby Julio Jerez » Mon Mar 26, 2012 7:30 am

it is very litle you need to do, basically replace the convex modifier with these functions
Code: Select all
   NEWTON_API NewtonCollision* NewtonCollisionCreateInstance (const NewtonCollision* const collision);
   NEWTON_API int NewtonCollisionGetType (const NewtonCollision* const collision);

   NEWTON_API void NewtonCollisionSetUserData (const NewtonCollision* const collision, void* const userData);
   NEWTON_API void* NewtonCollisionGetUserData (const NewtonCollision* const collision);
   
   NEWTON_API void NewtonCollisionSetUserID (const NewtonCollision* const collision, unsigned id);
   NEWTON_API unsigned NewtonCollisionGetUserID (const NewtonCollision* const collision);

   NEWTON_API void NewtonCollisionSetMatrix (const NewtonCollision* const collision, const dFloat* const matrix);
   NEWTON_API void NewtonCollisionGetMatrix (const NewtonCollision* const collision, dFloat* const matrix);

   NEWTON_API void NewtonCollisionSetScale (const NewtonCollision* const collision, dFloat scaleX, dFloat scaleY, dFloat scaleZ);
   NEWTON_API void NewtonCollisionGetScale (const NewtonCollision* const collision, dFloat* const scaleX, dFloat* const scaleY, dFloat* const scaleZ);



the way you use it is like this
Code: Select all
NewtonCollision* const collision = NewtonBodyGetCollision(body);
NewtonCollisionSetScale (collision, scaleX, scaleY, scaleZ);


I added the unit test deme, it is no implemnetd yet, by you can check it out.
in the next day or two I will get all of the funtionality.
I will do tow steps, uniform scale which is eassy and faster,
and then non unifrm scale.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Scaling API changes?

Postby Julio Jerez » Mon Mar 26, 2012 11:26 am

I check in the begining of the scale unifirm collision demo.

It is not complete yet because I need to go over the specilal cases collision liek sphere -(sphere, box, capsules, and polygon)
but you can see how it will work.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Scaling API changes?

Postby pHySiQuE » Mon Mar 26, 2012 1:00 pm

Cool, thanks!
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Scaling API changes?

Postby Julio Jerez » Thu Mar 29, 2012 9:01 am

Ok I added the first generalize collision scaling demo (uniform so far) but the modification to handle non nuform are minor.
there is still work to do but I think by the next check in, unifirm collision scaling will be fully sopported.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: Dave Gravel and 4 guests

cron