johan07

14-01-2013 19:03:55

Hi,

i posted my question in the view topic of Ogreprocedural and i will post it here :

my question is simple i want to make this shape

but i have no idea what are the shapes that i can use them in extrusion to obtained this shape

Just create a half profile of your geometry and use the lathe generator.

half profile you mean icreate half cylinder ?

if i use this method can i get or caculate the volume of the shape ?

mikachu

14-01-2013 20:20:15

The lathe generator takes a 2D shape as input and extrudes it around the Y-Axis, producing a mesh.

For example, if you do that with a 2D line parallel with Y-Axis, it will make a cylinder.

As the shape is provided by the user, it's rather flexible and allows for more complex meshes than just a cylinder (and from your picture, you could reproduce that curve)

For example, you can produce a vase with it (see the amphors in Sample_Extrusion)

Considering the volume calculation, there's no function for this in OgreProcedural (and if your only goal is to compute the volume, you don't need this library).

But for a lathed shape, it's rather easy to compute...

Let's say your mesh is equivalent to an array of truncated cones.

The volume of each truncated cone would be Pi*H*(R1^2+R2^2)

You just have to sum it across the whole mesh

Transporter

14-01-2013 20:51:14

half profile you mean icreate half cylinder ?

I mean that you create not a full cross-sectional area, just half of it for rotation. You can create a shape like this:

Then you can use lathe generator to rotate the shape to a full cylinder. Of course you can use a more smooth shape, this is just an example.

if i use this method can i get or caculate the volume of the shape ?

No. You have a few options:

- You can detect the bounding box and calculate it's value. This gives a verry rough estimation of the volume.[/*:m]
- Your part is a rotational one. You can combine cylinders and cones by hand and then calculate the volumes and sum them up for the exact result.[/*:m]
- If you have a spline for your shape, you can make an itterative solution to get the volume. Just cut the shape over the vertical axis into a lot of pieces by getting the points. Now you have two radians for each slice and calculate approxemately a cylineder or a cone volume for it and sum it up.[/*:m][/list:o]