3

I found this example here of two intersecting spheres, have reproduced a couple Tikz spheres that I found here which is the code below. I however would like to know how to get these two spheres to intersect - but also to embed them in/draw a larger sphere around both that is just big enough in the XY plane to house the two.

I am thinking more general - that somehow maybe I could just create a general "Sphere" and instantiate 3 spheres of different sizes and move them around until they look correct. That might be the good way to go.

Thanks for your insights.

\documentclass[tikz,border=10pt]{standalone}
    \begin{figure}[htb]
    \tdplotsetmaincoords{55}{5}
    \begin{tikzpicture}
        [scale=3,
            tdplot_main_coords,
            curve/.style={black}]

        \coordinate (O) at (0,0,0);

        \foreach \angle in {-90,-75,...,90}
        {
            %calculate the sine and cosine of the angle
            \tdplotsinandcos{\sintheta}{\costheta}{\angle}%

            %define a point along the z-axis through which to draw
            %a circle in the xy-plane
            \coordinate (P) at (0,0,\sintheta);

            %draw the circle in the main frame
            \tdplotdrawarc[curve]{(P)}{\costheta}{0}{360}{}{}

            %define the rotated coordinate frame based on the angle
            %\tdplotsetthetaplanecoords{\angle}

            %draw the circle in the rotated frame
            %\tdplotdrawarc[curve,tdplot_rotated_coords]{(O)}{1}{0}{360}{}{}
        }

    \end{tikzpicture}
    \tdplotsetmaincoords{30}{5}
    \begin{tikzpicture}
        [scale=2,
            tdplot_main_coords,
            curve/.style={black}]

        \coordinate (O) at (-130,0,0);

        \foreach \angle in {-90,-75,...,90}
        {
            %calculate the sine and cosine of the angle
            \tdplotsinandcos{\sintheta}{\costheta}{\angle}%

            %define a point along the z-axis through which to draw
            %a circle in the xy-plane
            \coordinate (P) at (0,0,\sintheta);

            %draw the circle in the main frame
            \tdplotdrawarc[curve]{(P)}{\costheta}{0}{360}{}{}

            %define the rotated coordinate frame based on the angle
            %\tdplotsetthetaplanecoords{\angle}

            %draw the circle in the rotated frame
            %\tdplotdrawarc[curve,tdplot_rotated_coords]{(O)}{1}{0}{360}{}{}
        }

    \end{tikzpicture}
    \end{figure}
 \end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.