Cylinder-Cylinder Intersection

Author

Eric W. Weisstein
May 4, 2021

This notebook downloaded from http://mathworld.wolfram.com/notebooks/SolidGeometry/Cylinder-CylinderIntersection.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/Cylinder-CylinderIntersection.html.

©2021 Wolfram Research, Inc. except for portions noted otherwise

Source

https://nvlpubs.nist.gov/nistpubs/jres/69C/jresv69Cn2p139_A1b.pdf

JOURNAL OF RESEARCH of the National Bureau of Standards-C . Engineering and Instrumentation Vol. 69C, No.2, April-June 1965
Common Volume of Two Intersecting Cylinders J. H. Hubbell
(October 29, 1964)

Volume integral

$Version

bug(409522): Assuming[0 < r1 < r2, Integrate[2 Sqrt[r2^2 - x^2] (2 Sqrt[r1^2 - x^2])/Sin[beta], {x, -r1, r1}]] should return the same result as Assuming[r1 > 0 && r2 > 0, ...]

(v=Assuming[r1>0,Integrate[2(Sqrt[(r2^2)-(x^2)])((2(Sqrt[(r1^2)-(x^2)]))/(Sin[β])),{x,-r1,r1}]])//Timing

Simplify[v,r2>0]

(v=Assuming[r1>0&&r2>0,Integrate[2(Sqrt[(r2^2)-(x^2)])((2(Sqrt[(r1^2)-(x^2)]))/(Sin[β])),{x,-r1,r1}]])//Timing

TimeConstrained[v=Assuming[0<r1<r2,Integrate[2(Sqrt[(r2^2)-(x^2)])((2(Sqrt[(r1^2)-(x^2)]))/(Sin[β])),{x,-r1,r1}]],60]//Timing

(v=Assuming[r1>0&&r1>0,Integrate[2(Sqrt[(r2^2)-(x^2)])((2(Sqrt[(r1^2)-(x^2)]))/(Sin[β])),{x,-r1,r1}]])//Timing

(v=(8/(Sin[β]))Assuming[0<r1<r2,Integrate[(Sqrt[(r2^2)-(x^2)])(Sqrt[(r1^2)-(x^2)]),{x,0,r1}]])//Timing

Closed forms

expr1=2π (k^2)Hypergeometric2F1[-(1/2),(1/2),2,(k^2)]

((r2^3)/(Sin[β]))expr1/.k->r1/r2

expr2=4π Sum[Binomial[(1/2),n]Binomial[(1/2),n-1](k^(2n)),{n,∞}]

expr3=FullSimplify[(8/3)((1+(k^2))EllipticE[(k^2)]-(1-(k^2))EllipticK[(k^2)])]

expr4=8Assuming[0<k<1,Integrate[k EllipticE[(k^2)],{k,0,k}]]

FullSimplify[expr1-expr3]

FunctionExpand[expr1]//FullSimplify

RegionIntersction

(Subscript[r, 1])==(Subscript[r, 2])

(v=(8/(Sin[β]))Assuming[r>0,Integrate[(r^2)-(x^2),{x,0,r}]])//Timing

Entity["Solid","Steinmetz2Solid"]["Volume"][r]

RegionIntersction

Assuming[r<10,Volume[RegionIntersection[
Cylinder[1000{{0,0,-1},{0,0,1}},r],
Cylinder[1000{{-1,0,0},{1,0,0}},r]]]]//Timing

Properties

reg=ImplicitRegion[(x^2)+(((y Cos[β]-z Sin[β]))^2)<=r1^2&&x^2+y^2≤r2^2,{x,y,z}]

BoundingBox

Assuming[0<r1<r2&&β>0,FullSimplify[MaxValue[x,{x,y,z}∈reg]]]

Assuming[0<r1<r2&&0<β<π/2,FullSimplify[MaxValue[y,{x,y,z}∈reg]]]

Assuming[0<r1<r2&&0<β<=π/2,FullSimplify[MaxValue[z,{x,y,z}∈reg]]]

Expand[%]

Limit[r2 Cot[β]+r1 Csc[β],β->0]

Centroid

(i=Assuming[0<r1<r2&&β>0,Integrate[{x,y,z}Boole[(x^2)+(((Cos[β] y-z Sin[β]))^2)<(r1^2)&&(x^2)+(y^2)≤(r2^2)]{x,-r1,r1},{y,-r2,r2},{z,-(r1 Csc[β]+r2 Cot[β]),r1 Csc[β]+r2 Cot[β]}]])//Timing

Inequalities

(mat=RotationMatrix[π/2+β,{1,0,0}])//TraditionalForm

mat.{0,0,1}

x^2+z^2/.Thread[{x,y,z}->mat.{x,y,z}]//FullSimplify

With[{β=π/4,a=1,r=3},RegionPlot3D[(x^2)+(((y Cos[β]-z Sin[β]))^2)<a^2,{x,-r,r},{y,-r,r},{z,-r,r},Boxed->False,Axes->True,AxesOrigin->{0,0,0},AxesLabel->{x,y,z}]]

With[{β=π/4,r1=1,r2=2,r=3},RegionPlot3D[(x^2)+(((y Cos[β]-z Sin[β]))^2)<r1^2&&x^2+y^2≤r2^2,
{x,-r,r},{y,-r,r},{z,-r,r},Boxed->False,Axes->True,AxesOrigin->{0,0,0},AxesLabel->{x,y,z}]]

Manipulate[Show[RegionPlot3D[(x^2)+(((y Cos[β]-z Sin[β]))^2)<r1^2&&x^2+y^2≤r2^2,
{x,-r2,r2},{y,-r2,r2},{z,-(r1 Csc[β]+r2 Cot[β]),r1 Csc[β]+r2 Cot[β]},BoxRatios->Automatic,PlotPoints->30],
Graphics3D[{Thickness[.05],
Red,Arrow[{{0,0,0},{2,0,0}}],
Green,Arrow[{{0,0,0},{0,2,0}}]
}]],{r1,.1,1},{r2,.2,2},{β,.1,π/2}]

Manipulate[Show[RegionPlot3D[(x^2)+(((y Cos[β]-z Sin[β]))^2)<r1^2&&x^2+y^2≤r2^2,
{x,0,r2},{y,-r2,r2},{z,0,r1 Csc[β]+r2 Cot[β]},BoxRatios->Automatic,PlotPoints->30],
Graphics3D[{Thickness[.05],
Red,Arrow[{{0,0,0},{2,0,0}}],
Green,Arrow[{{0,0,0},{0,2,0}}]
}]],{r1,.1,1},{r2,.2,2},{β,.1,π/2}]

MeanSquareCylindricalRadius

Assuming[0<r1<r2&&0<β<π/2,Integrate[(x^2+y^2)Boole[(x^2)+(((Cos[β] y-z Sin[β]))^2)<(r1^2)&&(x^2)+(y^2)≤(r2^2)],{x,-r1,r1},{y,-∞,∞},{z,-r2,r2}]]//Timing

Region

reg=With[{β=π/2,r1=1,r2=1},ImplicitRegion[(x^2)+(((y Cos[β]-z Sin[β]))^2)<r1^2&&x^2+y^2≤r2^2,{x,y,z}]]

Region[reg]

Cot[π/2]

Sec[π/2]

With[{β=π/2,r1=1,r2=1},RegionIntersection[Cylinder[{{0,-Sin[β],-Cos[β]},{0,Sin[β],Cos[β]}} Piecewise[{{r2,β==Pi/2}},(r1 Cot[β]+r2 Sec[β])],r1],Cylinder[{{0,0,-1},{0,0,1}} (r1 Csc[β]+r2 Cot[β]),r2]]]//Region

{{0,-Sin[β],-Cos[β]},{0,Sin[β],Cos[β]}} (r1 Cot[β]+r2 Csc[β])/.β->π/2

With[{β=π/2-.01,r1=1,r2=1},RegionIntersection[Cylinder[{{0,-Sin[β],-Cos[β]},{0,Sin[β],Cos[β]}} (r1 Cot[β]+r2 Csc[β]),r1],Cylinder[{{0,0,-1},{0,0,1}} (r1 Csc[β]+r2 Cot[β]),r2]]]//Region

With[{β=.5,r1=1,r2=1},RegionIntersection[Cylinder[{{0,-Sin[β],-Cos[β]},{0,Sin[β],Cos[β]}} (r1 Cot[β]+r2 Csc[β]),r1],Cylinder[{{0,0,-1},{0,0,1}} (r1 Csc[β]+r2 Cot[β]),r2]]]//Region

Manipulate[
Graphics3D[{
{Opacity[.2],
c1=Cylinder[{{0,-Sin[β],-Cos[β]},{0,Sin[β],Cos[β]}} (r1 Cot[β]+r2 Csc[β]),r1],
c2=Cylinder[{{0,0,-1},{0,0,1}} (r1 Csc[β]+r2 Cot[β]),r2]
},
Red,
RegionPlot3D[RegionIntersection[c1,c2],PlotPoints->30][[1]]
}],
{{r1,1},.1,2},{{r2,1.5},1,3},{{β,π/2},0,π}]

SurfaceArea

Volume

Volume[reg]//Timing

Symmetrical about x and z but not y:

Manipulate[Show[RegionPlot3D[(x^2)+(((y Cos[β]-z Sin[β]))^2)<r1^2&&x^2+y^2≤r2^2,
{x,0,r2},{y,-r2,r2},{z,0,r1 Csc[β]+r2 Cot[β]},BoxRatios->Automatic,PlotPoints->30],
Graphics3D[{Thickness[.02],Arrowheads[.1],
Red,Arrow[{{0,0,0},{1.5,0,0}}],
Green,Arrow[{{0,0,0},{0,1.5,0}}]
}]],{{r1,1},.1,1},{{r2,1.5},.2,2},{{β,π/4},.1,π/2}]

r1==r2==a

Assuming[a>0,With[{r1=a,r2=a,β=π/2},Integrate[Boole[(x^2)+(((Cos[β] y-z Sin[β]))^2)<(r1^2)&&(x^2)+(y^2)≤(r2^2)],{x,-r1,r1},{y,-r2,r2},{z,-(r1 Csc[β]+r2 Cot[β]),r1 Csc[β]+r2 Cot[β]}]]]

r1==1, r2==2, β=π/4

With[{r1=1,r2=2,β=π/4},Integrate[Boole[(x^2)+(((Cos[β] y-z Sin[β]))^2)<(r1^2)&&(x^2)+(y^2)≤(r2^2)],{x,-r1,r1},{y,-r2,r2},{z,-(r1 Csc[β]+r2 Cot[β]),r1 Csc[β]+r2 Cot[β]}]]

N[%]

With[{r1=1,r2=2,β=π/4},4Integrate[Boole[(x^2)+(((Cos[β] y-z Sin[β]))^2)<(r1^2)&&(x^2)+(y^2)≤(r2^2)],{x,0,r1},{y,-r2,r2},{z,0,r1 Csc[β]+r2 Cot[β]}]]//Simplify

%//N

2 π (r1^2) r2 Csc[β] Hypergeometric2F1[-(1/2),(1/2),2,((r1^2)/(r2^2))]/.{r1->1,r2->2,β->π/4}

N[%]

r1==1, r2==1.5, β==.2

With[{r1=1,r2=1.5,β=.2},NIntegrate[Boole[(x^2)+(((Cos[β] y-z Sin[β]))^2)<(r1^2)&&(x^2)+(y^2)≤(r2^2)],{x,-r1,r1},{y,-r2,r2},{z,-(r1 Csc[β]+r2 Cot[β]),r1 Csc[β]+r2 Cot[β]}]]

2 π (r1^2) r2 Csc[β] Hypergeometric2F1[-(1/2),(1/2),2,((r1^2)/(r2^2))]/.{r1->1,r2->1.5,β->.2}

General

The perpendicular version hangs:

(i=Assuming[0<r1<r2>0&&β>0,4Integrate[Boole[(x^2)+(((Cos[β] y-z Sin[β]))^2)<(r1^2)&&(x^2)+(y^2)≤(r2^2)],{x,0,r1},{y,-r2,r2},{z,0,r1 Csc[β]+r2 Cot[β]}]])//Timing

The perpendicular version evaluates:

(i=Assuming[r1>0&&r2>0&&β>0,4Integrate[Boole[(x^2)+(((Cos[β] y-z Sin[β]))^2)<(r1^2)&&(x^2)+(y^2)≤(r2^2)],{x,0,r1},{y,-r2,r2},{z,0,r1 Csc[β]+r2 Cot[β]}]])//Timing

(((Cos[β] y-z Sin[β]))^2)//Expand

x

(i=Assuming[r1>0&&r2>0&&β>0,4Integrate[Boole[(x^2)+(((Cos[β] y-z Sin[β]))^2)<(r1^2)&&(x^2)+(y^2)≤(r2^2)],{x,0,r1}]])//Timing

y

(i=Assuming[r1>0&&r2>0&&β>0,4Integrate[Boole[(x^2)+(((Cos[β] y-z Sin[β]))^2)<(r1^2)&&(x^2)+(y^2)≤(r2^2)],{y,-r2,r2}]])//Timing

z

(i=Assuming[r1>0&&r2>0&&β>0,4Integrate[Boole[(x^2)+(((Cos[β] y-z Sin[β]))^2)<(r1^2)&&(x^2)+(y^2)≤(r2^2)],{z,0,r1 Csc[β]+r2 Cot[β]}]])//Timing