I posted the following in MSE: (See Here)

Consider two cylinders Cs (solid) and Ch (hollow):

Cylinder Cs has a radius rs, and has the points (x1,y1,z1) and (x2,y2,z2) as the centers of its bases.

Cylinder Ch has a radius rh, and has the points (x3,y3,z3) and (x4,y4,z4) as the centers of its bases (no solid bases).

The hollow cylinder, Ch, acts as a cutter, where it moves a distance d in the direction of the outward-pointing normal at either (x3,y3,z3) or (x4,y4,z4), whichever specified. So the axis is fixed.

In some cases, the cutter will never cross the solid cylinder, regardless of d.

In some cases, the cutter will cross the solid cylinder, but will not form a complete cut. Say when d is not enough.

In some cases, when d is large enough, and the axes are parallel and the base of Ch will entirely cross the base of Cs. In this case we will have cut piece that is "exactly" cylindrical in shape.

Also there are other cases, say when the axes are perpendicular and rs>rh, so we will have a cut that is "not exactly" cylindrical in shape (it has curvy bases).

Furthermore, when the axes are neither parallel nor perpendicular, then the resultant piece may or may not have a part of the base of Cs depending upon the direction of the cutter.

Keeping in mind the cases when rs>rh and when rs<rh.

And there are many other cases are there!

I wish I can do some illustrations like here (NOT EXACTLY SAME). I am having two cylinders.

The simplest case when the cylinders do not cross each other, the volume is 0.

For uncomplete cut, the volume should be considered as 0.

Given rs,rh,(x1,y1,z1),(x2,y2,z2),(x3,y3,z3),(x4,y4,z4),d and the direction, can we evaluate the volume of the cut piece, if any, without specifying the case?

Is there any explicit formula for this?

Also how can we graph this in 3D using mathematica (or other software or website) by giving rs, rh, x1, x2, x3, x4, y1, y2, y3, y4, d and direction of movement?

Your help would be appreciated. Thanks!


1 Answer 1


A possible general approach (not fully verified or optimized). The strategy is as follow:

  1. Position the solid and cutting cylinders (also solid in my case).
  2. Move the cutting cylinder along its axis
  3. Create a longer cylinder from the beginning position to the end position after movement. This long cylinder reprsents the path traveled.
  4. If the long cylinder does not intercept the solid cylinder, the volume is 0.
  5. If it intercepts, the volume may be 0 if the disk at the base of the cutting cylinder has not cleared the solid cylinder (i.e. does not intercept the solid cylinder).
  6. if the volume is not 0, then it is the intersection of the long cylinder with the solid cylinder.
(* solid cylinder *)
{x1, y1, z1} = {1, 1, 1};
{x2, y2, z2} = {2, 2, 2};
rs = 1;
cs = Cylinder[{{x1, y1, z1}, {x2, y2, z2}}, rs];
regS = Region[cs];

(* cutting cylinder (also solid here)*)
{x3, y3, z3} = {2.8, 1.7, 2.4};
{x4, y4, z4} = {3.3, 1.05, 3.5};
rh = 0.40;
ch = Cylinder[{{x3, y3, z3}, {x4, y4, z4}}, rh];
regH = Region@ch;
RegionUnion[regS, regH]

(* movement of cutting cylinder (vector) *)

v = Normalize[{x4, y4, z4} - {x3, y3, z3}];

(* move cylinder *)
d = -1.8;
ch = Cylinder[{{x3, y3, z3} + d v, {x4, y4, z4} + d v}, rh];
regH = Region[ch];
RegionUnion[regS, regH]

(* volume is either 0 or intersection the path of the cutting \
cylinder traversing the solid cylinder *)

sort = SortBy[{{x3, y3, z3}, {x4, y4, z4}, {x3, y3, z3} + 
     d v, {x4, y4, z4} + d v}, Nearest];
longCyl = Cylinder[{sort[[1]], sort[[4]]}, rh];
regLongCylinder = Region@longCyl;
maxVolume = Volume@RegionIntersection[regS, regLongCylinder];
volume = 0;
If[maxVolume > 0, 
 closestBase = 
   MinimalBy[{sort[[1]], sort[[4]]}, RegionDistance[regS, #] &]];
 disk = Region[Cylinder[{closestBase, 0.0001 v + closestBase}, rh]];
 If[RegionEqual[RegionIntersection[regS, disk], EmptyRegion[3]], 
  volume = maxVolume, volume = 0];

RegionUnion[regS, regLongCylinder]

The above code diplays three regions and the volume. The three regions displayed are: initial position, final position, long cylinder.

enter image description here

The following is an example of long cylinder when the volume given would be 0, because the cutting cylinder has not cleared the solid cylinder.
enter image description here

  • $\begingroup$ These cylinders really illustrate my (mathematical) problem. Thanks a lot! $\endgroup$ Aug 12, 2022 at 10:50

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.