Question About NewtonCreateChamferCylinder

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Question About NewtonCreateChamferCylinder

Postby Bill » Tue Jun 30, 2015 3:16 pm

Hello,

I'm trying to understand what exactly I'm creating with NewtonCreateChamferCylinder, but I'm struggling. I was hoping I might be able to get a little bit of guidance.

Basically, it isn't completely clear to me from the documentation for this function what the radius and height parameters represent. I was attempting to use the NewtonBodyGetAABB function to help me visualize the chamfer cylinder as follows:

Code: Select all
QMatrix4x4 baseMatrix;
NewtonCollision* const baseCollision = NewtonCreateChamferCylinder(world, 1, .25, 0, baseMatrix.constData());

QMatrix4x4 myMatrix;
NewtonBody* baseBody = NewtonCreateDynamicBody(world, baseCollision, myMatrix.constData());

QVector3D p0;
QVector3D p1;
NewtonBodyGetAABB(baseBody, &p0[0], &p1[0]);


When I look at the p0 and p1 vectors (the corners of the bounding box), the bounding box for this example is:

-0.1875 < X < 0.1875
-1.1875 < Y < 1.1875
-1.1875 < Z < 1.1875

Those aren't exactly what I was expecting to see. I was expecting that this chamfer cylinder would be bound by one of the following boxes (depending on whether the height parameter the full height or half height):

-0.25 < X < 0.25
-1.25 < Y < 1.25
-1.25 < Z < 1.25

or

-0.125 < X < 0.125
-1.125 < Y < 1.125
-1.125 < Z < 1.125

When I try smaller numbers for the radius and height, such as this...

Code: Select all
NewtonCollision* baseCollision = NewtonCreateChamferCylinder(world, 0.02, 0.005, 0, baseMatrix.constData());


...the bounding box is even tougher to understand:

-0.065 < X < 0.065
-0.085 < Y < 0.085
-0.085 < Z < 0.085

It seems like maybe I'm confused on something here. Can anyone out there offer any guidance? For reference, below is a 2D image of what I thought the chamfer cylinder looked like. The chamfer cylinder shape would be what you'd get if you revolve the profile 360 degrees about the dotted line. Maybe my sketch is completely wrong! I appreciate whatever help I can get on this, as I'm genuinely confused!

chamfer-cylinder.JPG
chamfer-cylinder.JPG (19.77 KiB) Viewed 3804 times


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

Re: Question About NewtonCreateChamferCylinder

Postby Julio Jerez » Tue Jun 30, 2015 3:39 pm

the dimension you places in the image are correct. there at the also define a regular cylinder

the different is that the one chamfer the cylinder around the size, do the final radio is
the radio you pass in plus half the height of the cylinder.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Question About NewtonCreateChamferCylinder

Postby Bill » Tue Jun 30, 2015 3:52 pm

Julio Jerez wrote:the dimension you places in the image are correct. there at the also define a regular cylinder

the different is that the one chamfer the cylinder around the size, do the final radio is
the radio you pass in plus half the height of the cylinder.


Thanks a lot, Julio.

Do you have any idea why the bounding boxes I showed in the examples above don't match up to what I would have expected them to be based on the sketch?

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

Re: Question About NewtonCreateChamferCylinder

Postby Julio Jerez » Tue Jun 30, 2015 5:00 pm

the aabb will et for NewtonBodyGetAABB is going to be bigger because it is quatized for the Broad phase efficiency.

if you want a precise aabb you can use this function for file: ../\applications\demosSandbox\sdkDemos\toolBox\PhysicsUtils.h
void CalculateAABB (const NewtonCollision* const collision, const dMatrix& matrix, dVector& minP, dVector& maxP);
you can just copy the function from the helper.

you call it with the collision and the matrix from the body.
By changing the matrix you can give AABB of any space you want, you can get the OBB or an base on what matrix you pass.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Question About NewtonCreateChamferCylinder

Postby Bill » Wed Jul 01, 2015 3:42 pm

Julio Jerez wrote:if you want a precise aabb you can use this function for file: ../\applications\demosSandbox\sdkDemos\toolBox\PhysicsUtils.h
void CalculateAABB (const NewtonCollision* const collision, const dMatrix& matrix, dVector& minP, dVector& maxP);
you can just copy the function from the helper.


Julio,

Thank you very much...that is very helpful to me.

Not to get too off-topic here, but when I was making very small chamfer cylinders (radius = 0.02, height = 0.004), I couldn't seem to get them to sit still when resting on a plane. They were very jittery and unstable, it seemed. Scaling all the geometry up by a factor of 100 made all the jittering and instability go away completely. Is that what you would expect with such small geometry due to some sort of numerical issue?

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

Re: Question About NewtonCreateChamferCylinder

Postby Julio Jerez » Wed Jul 01, 2015 4:28 pm

a body that is 4 millimeter is size will be jittery because at that size the numerical error can no be distinguished from any mean full value
you do not have to scale 100 time I believe that 0.01 will work fine.

In newton almost all algorithm are iterative, and in order to make sure the terminate in a reusable amount of time of time to releases has to be specified. one such tolerance is the minim distance between to adjacent contact which I think is 1/128 (0.007)
so if you have the value the shape is only 0.004 then contact the criteria for decimation contact make no longer sense so which you get is contacts jumping all over the shape.

I physic library has to make many compromises, you can not have some the can haggle a shape the is 1000 meters together with one that is is 0.001, the dynamic range there is larger that can be coded in the mantissa of a flawt32, for that you need double precision and a lot more iterations and resize the tolerances.
Unfortunate in the engine for rational reason those tolerance are hard coded, and it is no trivial to make the indented because some for these go over no linear conversion, and example Is the GJK algorithm if you the tolerance at the same rate of the geometry you would thing you will get the same relative error, but it does no work that way, it look as if the convergence is independent of the error. Meaning you still have iterate until the error is very small otherwise the result is meaningless.

.

what are you doing that you need such small objects?
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: No registered users and 1 guest

cron