Cylinder Shape

AkaHM
Posts: 3
Joined: Mon Oct 25, 2010 4:02 pm

Cylinder Shape

Post by AkaHM »

Hi,

I'm new on Bullet and I'm trying to create a Cylinder and querying its dimensions. I don't understand the constructor. It receives a vector3 but, what represents each component? If I call getRadius() it returns the first. What mean the two others? One should be the length but I have no idea what can represent the other.
User avatar
MrPuff
Posts: 14
Joined: Wed Oct 27, 2010 8:16 pm

Re: Cylinder Shape

Post by MrPuff »

By friend, I believe that the first parameter is the height of the cylinder, then the other two are the radius of the top and bottom of the cylinder.
User avatar
gennoevus
Posts: 39
Joined: Sun Oct 10, 2010 4:39 am

Re: Cylinder Shape

Post by gennoevus »

MrPuff wrote:By friend, I believe that the first parameter is the height of the cylinder, then the other two are the radius of the top and bottom of the cylinder.
This always bugged me too. Thanks for the answer!
mi076
Posts: 144
Joined: Fri Aug 01, 2008 6:36 am
Location: Bonn, Germany

Re: Cylinder Shape

Post by mi076 »

Imagine a box your cylinder fits into - parameters are half sizes, btCylinderShape is Y axis aligned, so 2nd parameter is hight/2. There are no top and bottom radii, just one radius.
Set x = z = radius.
AkaHM
Posts: 3
Joined: Mon Oct 25, 2010 4:02 pm

Re: Cylinder Shape

Post by AkaHM »

Ok, thats matches better with my results. Then there are only two usefull parameters really. Thanks a lot.
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Cylinder Shape

Post by sparkprime »

isn't the base an ellipse?
AkaHM
Posts: 3
Joined: Mon Oct 25, 2010 4:02 pm

Re: Cylinder Shape

Post by AkaHM »

I don't think so, because then the function getRadius() doesn't have sense, there aren't a unique radius.
Carl
Posts: 7
Joined: Wed Oct 27, 2010 3:11 pm

Re: Cylinder Shape

Post by Carl »

The cone shape is the same way, having a circular radius and therefore having 2 parameters that
define the shape ( so use z=x, if its up-axis is y ) to be well defined w.r.t its bounding box.

Simularly the sphere has only one relevent parameter.

I believe the box shape is the only parametric shape that has 3 adjustable shape-defining parameters.

The 4 parametric shape types are great if you can live within their restrictions, elsewise make you object
a mesh.