NewtonCreateSphere / NewtonCreateCylinder Questions

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

NewtonCreateSphere / NewtonCreateCylinder Questions

Postby Bill » Mon Apr 24, 2017 10:33 am

Hello,

In reading through some older documentation and forum posts, it looks like it is possible to do the following things:

1) Create an ellipsoid of rotation using NewtonCreateSphere by specifying three radii (with two of them equal).

2) Create a cylinder with two different base radii using NewtonCreateCylinder.

I can't seem to figure out how to do either of these things...it looks like NewtonCreateSphere takes only one radius, and NewtonCreateCylinder takes only one radius.

Is it still possible to create these kinds of shapes in Newton? Any help would be greatly appreciated!
Bill
 
Posts: 22
Joined: Mon Oct 27, 2014 9:40 am

Re: NewtonCreateSphere / NewtonCreateCylinder Questions

Postby Julio Jerez » Mon Apr 24, 2017 10:47 am

yes those shape can be created, there were specify functions for some variant of generic shapes like truncated cylinders ellipsis and some others, in previous newton versions, since large part of the collision system was re written for 3.14, the realization that some of those shapes differ from the canonical shape by the scale, they were fused to generalized common function that can be modified by a calling scale or position after creation.
These are the definitions of the shape that takes two radius.
Code: Select all
NewtonCollision* NewtonCreateCapsule (const NewtonWorld* const newtonWorld, dFloat radius0, dFloat radius1, dFloat height, int shapeID, const dFloat* const offsetMatrix);
NewtonCollision* NewtonCreateCylinder (const NewtonWorld* const newtonWorld, dFloat radio0, dFloat radio1, dFloat height, int shapeID, const dFloat* const offsetMatrix);


this is for the sphere:
Code: Select all
NewtonCollision* NewtonCreateSphere (const NewtonWorld* const newtonWorld, dFloat radius, int shapeID, const dFloat* const offsetMatrix);

to make an ellipse from a sphere you just apply a local scale using function
Code: Select all
void NewtonCollisionSetScale (const NewtonCollision* const collision, dFloat scaleX, dFloat scaleY, dFloat scaleZ);
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCreateSphere / NewtonCreateCylinder Questions

Postby Bill » Mon Apr 24, 2017 10:58 am

Julio,

Thank you very much. I believe the version of Newton I'm using is about 18 months old (although I'm not sure exactly what version number it is).

I will download the latest from github and try building from that version of the code.

Thanks a lot,
Bill
Bill
 
Posts: 22
Joined: Mon Oct 27, 2014 9:40 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 15 guests