1
$\begingroup$

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]
partialVolumes=NIntegrate[interpol[x]^2,{x,0,radius}]*Pi/@Table[radius,{radius,0,16}]

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

$\endgroup$
1
  • $\begingroup$ 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. $\endgroup$
    – anderstood
    Nov 14, 2021 at 21:24

2 Answers 2

1
$\begingroup$

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}]

enter image description here

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*)

Addendum

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]

enter image description here

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}]

enter image description here

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*)
$\endgroup$
10
  • $\begingroup$ Why 2Pi and not just Pi ? $\endgroup$
    – anderstood
    Nov 14, 2021 at 20:16
  • $\begingroup$ 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 $\endgroup$
    – Niki
    Nov 14, 2021 at 20:43
  • $\begingroup$ @anderstood, thank's, was an error, I correted it. $\endgroup$ Nov 14, 2021 at 21:48
  • $\begingroup$ Simply define 2 functions:_ fxmin[y] and fxmax[y] and integrate from fxmin to fxmax. $\endgroup$ Nov 14, 2021 at 21:50
  • $\begingroup$ 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. $\endgroup$
    – Niki
    Nov 15, 2021 at 15:44
1
$\begingroup$

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}$$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.