Draw a regular tetrahedron in a cylinder

Let be given a cylinder and a regular tetrahedron ABCD so that AB lies on cylinder and AB equal to height of the cylinder. I am trying to consruct regular tetrahedron ABCD with C and D lies on cylinder. How can I do that?

I tried

r = 2;
h = 3
o = {0, 0, 0};
t = {0, 0, h};
myangle = -Pi/6;
aa = {r  Cos[myangle], r  Sin[myangle], 0};
bb = {r  Cos[myangle], r  Sin[myangle], h};
Graphics3D[{[email protected],
Cylinder[{o, t}, r], {Red, PointSize[Large], Point[{aa, bb}]},
Text[Style["A", Italic, 14,
FontFamily -> "Times"], {r  Cos[myangle],
r  Sin[myangle], -0.3}],
Text[Style["B", Italic, 14,
FontFamily -> "Times"], {r  Cos[myangle], r  Sin[myangle],
h + 0.3}]}, Axes -> False, Boxed -> False]


• For h=3,there no such tetrahedron. There are many other example indicate that h need to depend on r. For example,if r=2 and h=100, it is obvious that no solution.
• Here we do not fixed h.
Clear["Global*"];
r = 2;
o = {0, 0, 0};
t = {0, 0, h};
myangle = -Pi/6;
aa = {r Cos[myangle], r Sin[myangle], 0};
bb = {r Cos[myangle], r Sin[myangle], h};
c = {r Cos[u], r Sin[u], hc};
d = {r Cos[v], r Sin[v], hd};
sol = FindInstance[{EuclideanDistance[aa, c] ==
EuclideanDistance[aa, d] == EuclideanDistance[bb, c] ==
EuclideanDistance[bb, d] == EuclideanDistance[c, d] ==
EuclideanDistance[aa, bb], 0 < {u, v} < 2 π, 0 < hc < h,
0 < hd < h}, {u, v, hc, hd, h}]
sol // N
Graphics3D[{{Red, ConvexHullRegion[{aa, bb, c, d}]}, [email protected],
Cylinder[{o, t}, r]} /. sol]


{{u -> 3.84895, v -> 1.38703, hc -> 1.88562, hd -> 1.88562, h -> 3.77124}}

• We can also fixed h=3 and find such r. Maybe we can find the relation between h and r.
Clear["Global*"];
h = 3;
o = {0, 0, 0};
t = {0, 0, h};
myangle = -Pi/6;
aa = {r  Cos[myangle], r  Sin[myangle], 0};
bb = {r  Cos[myangle], r  Sin[myangle], h};
c = {r  Cos[u], r  Sin[u], hc};
d = {r  Cos[v], r  Sin[v], hd};
sol = FindInstance[{EuclideanDistance[aa, c] ==
EuclideanDistance[aa, d] == EuclideanDistance[bb, c] ==
EuclideanDistance[bb, d] == EuclideanDistance[c, d] ==
EuclideanDistance[aa, bb], 0 < {u, v} < 2  π, 0 < hc < h,
0 < hd < h}, {u, v, hc, hd, r}]
sol // N
Graphics3D[{{Red, ConvexHullRegion[{aa, bb, c, d}]}, [email protected],
Cylinder[{o, t}, r]} /. sol]
h/r /. sol // RootApproximant


{{u -> 1.38703, v -> 3.84895, hc -> 1.5, hd -> 1.5, r -> 1.59099}}

(4 Sqrt[2])/3

• Maybe, h be given and we find radius of base of cylinder is better. Commented Apr 23 at 2:30
• How can I find the number k from h = k * r exactly? Commented Apr 23 at 2:42
• @minhthien_2016 h/r /. sol // RootApproximant Commented Apr 23 at 2:48
• Thank you very much. Commented Apr 23 at 2:51

You can let Mathematica do the heavy lifting here. I'll take it as given that we know the height of an equilateral triangle to be Sqrt[3]/2 (for sidelength 1), but even that we could delegate to Mathematica if we really needed to. The cylinder's radius is obviously dependent upon the size of the tetrahedron, so I'll parameterize it for a given sidelength.

With[
{edgelength = 3},
With[
{tetraProjection = SSSTriangle @@ (edgelength  {1, Sqrt[3]/2, Sqrt[3]/2})},
With[
center = TriangleCenter[tetraProjection, "Circumcenter"]},
With[
{tetra =
Tetrahedron[
Append,
{Prepend[PolygonCoordinates[tetraProjection], {0, 0}], edgelength  {0, 1, .5, .5}}]]},
Graphics3D[
{Green, tetra,
Red, PointSize[.05], Point /@ MeshCoordinates[tetra],
Axes -> True]]]]]


Or, starting with a tetrahedron and finding the projection...

With[
{edgelength = 2},
With[
{tetra =
Tetrahedron[
{0, .5  TriangleMeasurement[SSSTriangle[1, Sqrt[3]/2, Sqrt[3]/2], {"InteriorAngle", 1}]},
edgelength]},
With[
{projection = Triangle[DeleteDuplicates[Drop[PolyhedronCoordinates[tetra], 0, -1]]]},
With[
{center = TriangleCenter[projection, "Circumcenter"],