# Revolve 2D set of points and calculate volume

I have a set of points, defining some 2D object (a cross-section). Here is an example:

points={{0, 0}, {14, 0}, {14.5, 1}, {15, 2}, {0, 16}}


To visualize the object:

ListLinePlot[points,Frame->True,FrameLabel->{"Radius","y-axis"}]


I would like to revolve the cross-section around the y-axis to obtain the volume of the 3D body. I would finally like to calculate fractional volumes of the 3D body by integrating over slices of the entire 3D object such as the slice radius 14 to 15.

My approach thus far was as follows (including a description of why I think it failed): The points have not always incrementing x values, therefore I cannot use Interpolation to generate an interpolating function and do the revolution as follows:

interpol=Interpolation[2Dpoints]


There are tons of examples of revolving functions, but non starting from discrete points describing an object.

• You can create an interpolation from the reals to real points with: path = First@FindCurvePath@Standardize@points; curve = Interpolation[MapIndexed[{#2[[1]], #1} &, points[[path]]], InterpolationOrder -> 1];. Check: ParametricPlot[curve[t], {t, 1, Length@path}]. Then, I believe you should be able to compute the integral by summing: Pi*NIntegrate[ curve[t][[1]]^2*curve'[t][[2]], {t, 1, Length@path}] // Abs however, it seems to be wrong. I'm not sure why, but I believe it's still a possible start with a mistake to correct. Nov 14, 2021 at 21:24

We best use cylinder coordinates to tackle this task. Toward this aim we define the x value, that is the radius, as a function of y:

points={{0, 0}, {14, 0}, {14.5, 1}, {15, 2}, {0, 16}};
fx[y_] = Interpolation[Reverse /@ Rest[points], InterpolationOrder -> 1][y]
Plot[fx[x], {x, 0, 16}]


The volume is then obtained by integrating the circular slices over the height, the y direction:

NIntegrate[Pi fx[y]^2, {y, 0, 16}]
(*4620.24*)


If we only want to integrate from slice radius 14 to 15:

NIntegrate[Pi fx[y]^2, {y, 14, 15}]
(*8.41498*)


If you have a min and a maximum value for the radius, depending on y, you define 2 functions fxmin and fxmax like e.g.:

From the original data:

Graphics[Line[{{7, 0}, {14.5, 1}, {15, 2}, {0, 8}, {7, 1}, {7, 0}}],  Frame -> True]


we get fmin, fmax by:

fxmin[y_] =
Interpolation[Reverse /@ {{7, 0}, {7, 1}, {0, 8}},
InterpolationOrder -> 1][y]
fxmax[y_] =
Interpolation[Reverse /@ {{7, 0}, {14.5, 1}, {15, 2}, {0, 8}},
InterpolationOrder -> 1][y]

Plot[{fxmin[y], fxmax[y]}, {y, 0, 8}]


Now we only have to integrate up the slices that have now a hole:

NIntegrate[Pi (fxmax[y]^2 - fxmin[y]^2), {y, 0, 8}]
(*1961.92*)

• Why 2Pi and not just Pi ? Nov 14, 2021 at 20:16
• I am sorry. Maybe my question was not clear enough. The object might be more complicated like this. Such that y simple x-y transformation does not do the trick. My points were only an example. It could look like Graphics[Line[{{7, 0}, {14.5, 1}, {15, 2}, {0, 8}, {7, 1}, {7, 0}}], Frame -> True] as well
– Niki
Nov 14, 2021 at 20:43
• @anderstood, thank's, was an error, I correted it. Nov 14, 2021 at 21:48
• Simply define 2 functions:_ fxmin[y] and fxmax[y] and integrate from fxmin to fxmax. Nov 14, 2021 at 21:50
• Have you seen my comment further up? There I provided an example for which your solution does not work. I am interested in any shape that I want to revolve to generate some kind of roundly shaped 3D objects. These objects I have to split radially to generate fractional volumes.
– Niki
Nov 15, 2021 at 15:44

Use a formula for the volume of a cone with base radii a and b and height h

$$\frac{1}{3} \pi h \left(a^2+a b+b^2\right)$$

v[a_, b_, h_] := Pi h/3 (a^2 + a b + b^2)
v[14, 29/2, 1] + v[29/2, 15, 1] + v[15, 0, 14]


Resulting in $$\frac{4412 \pi }{3}$$