Draw a calotte within a sphereHow can I draw an arc from point A -> B on a 3D sphere in TikZ?How is the center point of an arc path determined?Rotate a node but not its content: the case of the ellipse decorationHow can I draw tikz arrows on a calculated triangle?Calculate the intersection between a path enclosed by a `scope` and another pathtikz: draw a piece of a path between given coordinatesPGF: draw longitudinal arcs in 3D axis environmentTikZ: Drawing an arc from an intersection to an intersectionA node not being typesetLine up nested tikz enviroments or how to get rid of themtikz/pgfplots - Plotting 3D surface with sphere

Landlord wants to switch my lease to a "Land contract" to "get back at the city"

How can I fix this gap between bookcases I made?

How to make payment on the internet without leaving a money trail?

Patience, young "Padovan"

aging parents with no investments

Input two commands to a new terminal?

Does the average primeness of natural numbers tend to zero?

Sort in WP_Query(), not filter? Is it possible?

Why is the design of haulage companies so “special”?

What does "enim et" mean?

What does 'script /dev/null' do?

Extreme, but not acceptable situation and I can't start the work tomorrow morning

Does it makes sense to buy a cycle to learn riding?

Why doesn't a const reference extend the life of a temporary object passed via a function?

How to answer pointed "are you quitting" questioning when I don't want them to suspect

How to move the player while also allowing forces to affect it

Need help identifying/translating a plaque in Tangier, Morocco

How can I add custom success page

Could a US political party gain complete control over the government by removing checks & balances?

Information to fellow intern about hiring?

How do you conduct xenoanthropology after first contact?

Is every set a filtered colimit of finite sets?

Is Fable (1996) connected in any way to the Fable franchise from Lionhead Studios?

I see my dog run



Draw a calotte within a sphere


How can I draw an arc from point A -> B on a 3D sphere in TikZ?How is the center point of an arc path determined?Rotate a node but not its content: the case of the ellipse decorationHow can I draw tikz arrows on a calculated triangle?Calculate the intersection between a path enclosed by a `scope` and another pathtikz: draw a piece of a path between given coordinatesPGF: draw longitudinal arcs in 3D axis environmentTikZ: Drawing an arc from an intersection to an intersectionA node not being typesetLine up nested tikz enviroments or how to get rid of themtikz/pgfplots - Plotting 3D surface with sphere













1















I'm still trying to get the hang of tikz.
I'm trying to shade a calotte within a sphere.
The code



begintikzpicture[font = sansmath]
coordinate (O) at (0,0);



% ball background color
shade[ball color = blue, opacity = 0.1] (0,0) circle [radius = 2cm];

% cone
beginscope
defrx0.71% horizontal radius of the ellipse
defry0.15% vertical radius of the ellipse
defz0.725% distance from center of ellipse to origin

path [name path = ellipse] (0,z) ellipse (rx and ry);
path [name path = horizontal] (-rx,z-ry*ry/z)
-- (rx,z-ry*ry/z);
path [name intersections = of = ellipse and horizontal];


endscope


% ball
draw (O) circle [radius=2cm];
% label of ball center point
filldraw (O) circle (1pt) node[below] $O$;

% radius
draw[densely dashed] (O) to [edge label = $1$] (-1.33,1.33) coordinate (x);
draw[densely dashed] (O) -- (1.33,1.33) coordinate (y);

% cut of ball surface
draw[red, densely dashed] (-1.36,1.46) arc [start angle = 170, end angle = 10,
x radius = 13.8mm, y radius = 3.6mm];
draw[red] (-1.29,1.52) arc [start angle=-200, end angle = 20,
x radius = 13.75mm, y radius = 3.15mm];

% label of cut of ball surface
draw (-1.2,2.2) -- (-0.23,1.1) node at (-1.37,2.37) $B$;

%angle
pic[draw,->,angle radius=.5cm,angle eccentricity=1.3,"$alpha$"][blue] angle=y--O--x;

endtikzpicture


gives me the sphere I'm working with and I want to have that:



enter image description here
I've tried fiddling with shade to no success.










share|improve this question







New contributor




medihde is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
























    1















    I'm still trying to get the hang of tikz.
    I'm trying to shade a calotte within a sphere.
    The code



    begintikzpicture[font = sansmath]
    coordinate (O) at (0,0);



    % ball background color
    shade[ball color = blue, opacity = 0.1] (0,0) circle [radius = 2cm];

    % cone
    beginscope
    defrx0.71% horizontal radius of the ellipse
    defry0.15% vertical radius of the ellipse
    defz0.725% distance from center of ellipse to origin

    path [name path = ellipse] (0,z) ellipse (rx and ry);
    path [name path = horizontal] (-rx,z-ry*ry/z)
    -- (rx,z-ry*ry/z);
    path [name intersections = of = ellipse and horizontal];


    endscope


    % ball
    draw (O) circle [radius=2cm];
    % label of ball center point
    filldraw (O) circle (1pt) node[below] $O$;

    % radius
    draw[densely dashed] (O) to [edge label = $1$] (-1.33,1.33) coordinate (x);
    draw[densely dashed] (O) -- (1.33,1.33) coordinate (y);

    % cut of ball surface
    draw[red, densely dashed] (-1.36,1.46) arc [start angle = 170, end angle = 10,
    x radius = 13.8mm, y radius = 3.6mm];
    draw[red] (-1.29,1.52) arc [start angle=-200, end angle = 20,
    x radius = 13.75mm, y radius = 3.15mm];

    % label of cut of ball surface
    draw (-1.2,2.2) -- (-0.23,1.1) node at (-1.37,2.37) $B$;

    %angle
    pic[draw,->,angle radius=.5cm,angle eccentricity=1.3,"$alpha$"][blue] angle=y--O--x;

    endtikzpicture


    gives me the sphere I'm working with and I want to have that:



    enter image description here
    I've tried fiddling with shade to no success.










    share|improve this question







    New contributor




    medihde is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      1












      1








      1








      I'm still trying to get the hang of tikz.
      I'm trying to shade a calotte within a sphere.
      The code



      begintikzpicture[font = sansmath]
      coordinate (O) at (0,0);



      % ball background color
      shade[ball color = blue, opacity = 0.1] (0,0) circle [radius = 2cm];

      % cone
      beginscope
      defrx0.71% horizontal radius of the ellipse
      defry0.15% vertical radius of the ellipse
      defz0.725% distance from center of ellipse to origin

      path [name path = ellipse] (0,z) ellipse (rx and ry);
      path [name path = horizontal] (-rx,z-ry*ry/z)
      -- (rx,z-ry*ry/z);
      path [name intersections = of = ellipse and horizontal];


      endscope


      % ball
      draw (O) circle [radius=2cm];
      % label of ball center point
      filldraw (O) circle (1pt) node[below] $O$;

      % radius
      draw[densely dashed] (O) to [edge label = $1$] (-1.33,1.33) coordinate (x);
      draw[densely dashed] (O) -- (1.33,1.33) coordinate (y);

      % cut of ball surface
      draw[red, densely dashed] (-1.36,1.46) arc [start angle = 170, end angle = 10,
      x radius = 13.8mm, y radius = 3.6mm];
      draw[red] (-1.29,1.52) arc [start angle=-200, end angle = 20,
      x radius = 13.75mm, y radius = 3.15mm];

      % label of cut of ball surface
      draw (-1.2,2.2) -- (-0.23,1.1) node at (-1.37,2.37) $B$;

      %angle
      pic[draw,->,angle radius=.5cm,angle eccentricity=1.3,"$alpha$"][blue] angle=y--O--x;

      endtikzpicture


      gives me the sphere I'm working with and I want to have that:



      enter image description here
      I've tried fiddling with shade to no success.










      share|improve this question







      New contributor




      medihde is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      I'm still trying to get the hang of tikz.
      I'm trying to shade a calotte within a sphere.
      The code



      begintikzpicture[font = sansmath]
      coordinate (O) at (0,0);



      % ball background color
      shade[ball color = blue, opacity = 0.1] (0,0) circle [radius = 2cm];

      % cone
      beginscope
      defrx0.71% horizontal radius of the ellipse
      defry0.15% vertical radius of the ellipse
      defz0.725% distance from center of ellipse to origin

      path [name path = ellipse] (0,z) ellipse (rx and ry);
      path [name path = horizontal] (-rx,z-ry*ry/z)
      -- (rx,z-ry*ry/z);
      path [name intersections = of = ellipse and horizontal];


      endscope


      % ball
      draw (O) circle [radius=2cm];
      % label of ball center point
      filldraw (O) circle (1pt) node[below] $O$;

      % radius
      draw[densely dashed] (O) to [edge label = $1$] (-1.33,1.33) coordinate (x);
      draw[densely dashed] (O) -- (1.33,1.33) coordinate (y);

      % cut of ball surface
      draw[red, densely dashed] (-1.36,1.46) arc [start angle = 170, end angle = 10,
      x radius = 13.8mm, y radius = 3.6mm];
      draw[red] (-1.29,1.52) arc [start angle=-200, end angle = 20,
      x radius = 13.75mm, y radius = 3.15mm];

      % label of cut of ball surface
      draw (-1.2,2.2) -- (-0.23,1.1) node at (-1.37,2.37) $B$;

      %angle
      pic[draw,->,angle radius=.5cm,angle eccentricity=1.3,"$alpha$"][blue] angle=y--O--x;

      endtikzpicture


      gives me the sphere I'm working with and I want to have that:



      enter image description here
      I've tried fiddling with shade to no success.







      tikz-pgf






      share|improve this question







      New contributor




      medihde is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question







      New contributor




      medihde is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question






      New contributor




      medihde is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 1 hour ago









      medihdemedihde

      323




      323




      New contributor




      medihde is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      medihde is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      medihde is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          1 Answer
          1






          active

          oldest

          votes


















          2














          Like this?



          documentclass[tikz,border=3.14mm]standalone
          usepackagesansmath
          usepackagetikz-3dplot
          usetikzlibrary3d,backgrounds,quotes,angles,calc,patterns
          begindocument
          tdplotsetmaincoords8000
          begintikzpicture[tdplot_main_coords,font=sansmath]
          pgfmathsetmacroR2 % radius
          pgfmathsetmacromyang50 % latitude angle of the red circle
          coordinate (O) at (0,0,0);
          shade[ball color = blue, opacity = 0.2,tdplot_screen_coords]
          (O) circle [radius = R*1cm];
          beginscope[canvas is xy plane at z=R*sin(myang),transform shape]
          % angVis from https://tex.stackexchange.com/a/49589/121799
          pgfmathsetmacroangVisatan(sin(myang)*cos(tdplotmaintheta)/sin(tdplotmaintheta))
          beginscope[on background layer]
          draw[red,dashed] (angVis:R*cos(myang)) arc (angVis:180-angVis:R*cos(myang));
          endscope
          draw[red] (180-angVis:R*cos(myang)) arc (180-angVis:360+angVis:R*cos(myang));
          path (0:R*cos(myang)) coordinate (R)
          (180:R*cos(myang)) coordinate (L);
          endscope
          beginscope[on background layer]
          draw[dashed] (L) -- (O) node[midway,below] $L$ -- (R);
          fill (O) circle[radius=1pt] node[below] $O$;
          pic[draw,-latex,angle radius=.5cm,angle eccentricity=1.3,"$alpha$"]
          angle=R--O--L;
          endscope
          path[tdplot_screen_coords,pattern=north east lines,pattern color=green!70!black]
          let p1=(L),p2=(R),n1=atan2(y1,x1),n2=atan2(y2,x2)
          in (O) -- (R) arc(n2:n1:R) -- cycle;
          endtikzpicture
          enddocument


          enter image description here



          You can, of course, also add this to your code (which I find a bit more complicated than necessary, but this is only my opinion).



          documentclass[tikz,border=3.14mm]standalone
          usepackagesansmath
          usetikzlibraryquotes,angles,%intersections,%<- not used
          calc,patterns
          begindocument

          begintikzpicture[font = sansmath]
          coordinate (O) at (0,0);



          % ball background color
          shade[ball color = blue, opacity = 0.1] (0,0) circle [radius = 2cm];

          % cone you are not using this anywhere
          % beginscope
          % defrx0.71% horizontal radius of the ellipse
          % defry0.15% vertical radius of the ellipse
          % defz0.725% distance from center of ellipse to origin
          %
          % path [name path global=ellipse] (0,z) ellipse (rx and ry);
          % path [name path = horizontal] (-rx,z-ry*ry/z)
          % -- (rx,z-ry*ry/z);
          %
          %
          %
          % endscope


          % ball
          draw (O) circle [radius=2cm];
          % label of ball center point
          filldraw (O) circle (1pt) node[below] $O$;
          % radius
          draw[densely dashed] (O) to [edge label = $1$] (-1.33,1.33) coordinate (x);
          path[fill=green!70!black,fill opacity=0.5]
          (O) -- (45:2) arc(45:135:2cm) -- cycle;
          draw[densely dashed] (O) -- (1.33,1.33) coordinate (y);

          % cut of ball surface
          draw[red, densely dashed] (-1.36,1.46) arc [start angle = 170, end angle = 10,
          x radius = 13.8mm, y radius = 3.6mm];
          draw[red] (-1.29,1.52) arc [start angle=-200, end angle = 20,
          x radius = 13.75mm, y radius = 3.15mm];

          % label of cut of ball surface
          draw (-1.2,2.2) -- (-0.23,1.1) node at (-1.37,2.37) $B$;

          %angle
          pic[draw,->,angle radius=.5cm,angle eccentricity=1.3,"$alpha$"][blue] angle=y--O--x;
          endtikzpicture
          enddocument


          enter image description here






          share|improve this answer

























          • Perfect! If I wanted to have it completely green and not shaded, I'd only need to replace your code with fill right?

            – medihde
            59 mins ago











          • @medihde Yes. You may need to change the ordering in order not to overwrite the angle etc. I added a proposal.

            – marmot
            58 mins ago












          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "85"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );






          medihde is a new contributor. Be nice, and check out our Code of Conduct.









          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f483849%2fdraw-a-calotte-within-a-sphere%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          Like this?



          documentclass[tikz,border=3.14mm]standalone
          usepackagesansmath
          usepackagetikz-3dplot
          usetikzlibrary3d,backgrounds,quotes,angles,calc,patterns
          begindocument
          tdplotsetmaincoords8000
          begintikzpicture[tdplot_main_coords,font=sansmath]
          pgfmathsetmacroR2 % radius
          pgfmathsetmacromyang50 % latitude angle of the red circle
          coordinate (O) at (0,0,0);
          shade[ball color = blue, opacity = 0.2,tdplot_screen_coords]
          (O) circle [radius = R*1cm];
          beginscope[canvas is xy plane at z=R*sin(myang),transform shape]
          % angVis from https://tex.stackexchange.com/a/49589/121799
          pgfmathsetmacroangVisatan(sin(myang)*cos(tdplotmaintheta)/sin(tdplotmaintheta))
          beginscope[on background layer]
          draw[red,dashed] (angVis:R*cos(myang)) arc (angVis:180-angVis:R*cos(myang));
          endscope
          draw[red] (180-angVis:R*cos(myang)) arc (180-angVis:360+angVis:R*cos(myang));
          path (0:R*cos(myang)) coordinate (R)
          (180:R*cos(myang)) coordinate (L);
          endscope
          beginscope[on background layer]
          draw[dashed] (L) -- (O) node[midway,below] $L$ -- (R);
          fill (O) circle[radius=1pt] node[below] $O$;
          pic[draw,-latex,angle radius=.5cm,angle eccentricity=1.3,"$alpha$"]
          angle=R--O--L;
          endscope
          path[tdplot_screen_coords,pattern=north east lines,pattern color=green!70!black]
          let p1=(L),p2=(R),n1=atan2(y1,x1),n2=atan2(y2,x2)
          in (O) -- (R) arc(n2:n1:R) -- cycle;
          endtikzpicture
          enddocument


          enter image description here



          You can, of course, also add this to your code (which I find a bit more complicated than necessary, but this is only my opinion).



          documentclass[tikz,border=3.14mm]standalone
          usepackagesansmath
          usetikzlibraryquotes,angles,%intersections,%<- not used
          calc,patterns
          begindocument

          begintikzpicture[font = sansmath]
          coordinate (O) at (0,0);



          % ball background color
          shade[ball color = blue, opacity = 0.1] (0,0) circle [radius = 2cm];

          % cone you are not using this anywhere
          % beginscope
          % defrx0.71% horizontal radius of the ellipse
          % defry0.15% vertical radius of the ellipse
          % defz0.725% distance from center of ellipse to origin
          %
          % path [name path global=ellipse] (0,z) ellipse (rx and ry);
          % path [name path = horizontal] (-rx,z-ry*ry/z)
          % -- (rx,z-ry*ry/z);
          %
          %
          %
          % endscope


          % ball
          draw (O) circle [radius=2cm];
          % label of ball center point
          filldraw (O) circle (1pt) node[below] $O$;
          % radius
          draw[densely dashed] (O) to [edge label = $1$] (-1.33,1.33) coordinate (x);
          path[fill=green!70!black,fill opacity=0.5]
          (O) -- (45:2) arc(45:135:2cm) -- cycle;
          draw[densely dashed] (O) -- (1.33,1.33) coordinate (y);

          % cut of ball surface
          draw[red, densely dashed] (-1.36,1.46) arc [start angle = 170, end angle = 10,
          x radius = 13.8mm, y radius = 3.6mm];
          draw[red] (-1.29,1.52) arc [start angle=-200, end angle = 20,
          x radius = 13.75mm, y radius = 3.15mm];

          % label of cut of ball surface
          draw (-1.2,2.2) -- (-0.23,1.1) node at (-1.37,2.37) $B$;

          %angle
          pic[draw,->,angle radius=.5cm,angle eccentricity=1.3,"$alpha$"][blue] angle=y--O--x;
          endtikzpicture
          enddocument


          enter image description here






          share|improve this answer

























          • Perfect! If I wanted to have it completely green and not shaded, I'd only need to replace your code with fill right?

            – medihde
            59 mins ago











          • @medihde Yes. You may need to change the ordering in order not to overwrite the angle etc. I added a proposal.

            – marmot
            58 mins ago
















          2














          Like this?



          documentclass[tikz,border=3.14mm]standalone
          usepackagesansmath
          usepackagetikz-3dplot
          usetikzlibrary3d,backgrounds,quotes,angles,calc,patterns
          begindocument
          tdplotsetmaincoords8000
          begintikzpicture[tdplot_main_coords,font=sansmath]
          pgfmathsetmacroR2 % radius
          pgfmathsetmacromyang50 % latitude angle of the red circle
          coordinate (O) at (0,0,0);
          shade[ball color = blue, opacity = 0.2,tdplot_screen_coords]
          (O) circle [radius = R*1cm];
          beginscope[canvas is xy plane at z=R*sin(myang),transform shape]
          % angVis from https://tex.stackexchange.com/a/49589/121799
          pgfmathsetmacroangVisatan(sin(myang)*cos(tdplotmaintheta)/sin(tdplotmaintheta))
          beginscope[on background layer]
          draw[red,dashed] (angVis:R*cos(myang)) arc (angVis:180-angVis:R*cos(myang));
          endscope
          draw[red] (180-angVis:R*cos(myang)) arc (180-angVis:360+angVis:R*cos(myang));
          path (0:R*cos(myang)) coordinate (R)
          (180:R*cos(myang)) coordinate (L);
          endscope
          beginscope[on background layer]
          draw[dashed] (L) -- (O) node[midway,below] $L$ -- (R);
          fill (O) circle[radius=1pt] node[below] $O$;
          pic[draw,-latex,angle radius=.5cm,angle eccentricity=1.3,"$alpha$"]
          angle=R--O--L;
          endscope
          path[tdplot_screen_coords,pattern=north east lines,pattern color=green!70!black]
          let p1=(L),p2=(R),n1=atan2(y1,x1),n2=atan2(y2,x2)
          in (O) -- (R) arc(n2:n1:R) -- cycle;
          endtikzpicture
          enddocument


          enter image description here



          You can, of course, also add this to your code (which I find a bit more complicated than necessary, but this is only my opinion).



          documentclass[tikz,border=3.14mm]standalone
          usepackagesansmath
          usetikzlibraryquotes,angles,%intersections,%<- not used
          calc,patterns
          begindocument

          begintikzpicture[font = sansmath]
          coordinate (O) at (0,0);



          % ball background color
          shade[ball color = blue, opacity = 0.1] (0,0) circle [radius = 2cm];

          % cone you are not using this anywhere
          % beginscope
          % defrx0.71% horizontal radius of the ellipse
          % defry0.15% vertical radius of the ellipse
          % defz0.725% distance from center of ellipse to origin
          %
          % path [name path global=ellipse] (0,z) ellipse (rx and ry);
          % path [name path = horizontal] (-rx,z-ry*ry/z)
          % -- (rx,z-ry*ry/z);
          %
          %
          %
          % endscope


          % ball
          draw (O) circle [radius=2cm];
          % label of ball center point
          filldraw (O) circle (1pt) node[below] $O$;
          % radius
          draw[densely dashed] (O) to [edge label = $1$] (-1.33,1.33) coordinate (x);
          path[fill=green!70!black,fill opacity=0.5]
          (O) -- (45:2) arc(45:135:2cm) -- cycle;
          draw[densely dashed] (O) -- (1.33,1.33) coordinate (y);

          % cut of ball surface
          draw[red, densely dashed] (-1.36,1.46) arc [start angle = 170, end angle = 10,
          x radius = 13.8mm, y radius = 3.6mm];
          draw[red] (-1.29,1.52) arc [start angle=-200, end angle = 20,
          x radius = 13.75mm, y radius = 3.15mm];

          % label of cut of ball surface
          draw (-1.2,2.2) -- (-0.23,1.1) node at (-1.37,2.37) $B$;

          %angle
          pic[draw,->,angle radius=.5cm,angle eccentricity=1.3,"$alpha$"][blue] angle=y--O--x;
          endtikzpicture
          enddocument


          enter image description here






          share|improve this answer

























          • Perfect! If I wanted to have it completely green and not shaded, I'd only need to replace your code with fill right?

            – medihde
            59 mins ago











          • @medihde Yes. You may need to change the ordering in order not to overwrite the angle etc. I added a proposal.

            – marmot
            58 mins ago














          2












          2








          2







          Like this?



          documentclass[tikz,border=3.14mm]standalone
          usepackagesansmath
          usepackagetikz-3dplot
          usetikzlibrary3d,backgrounds,quotes,angles,calc,patterns
          begindocument
          tdplotsetmaincoords8000
          begintikzpicture[tdplot_main_coords,font=sansmath]
          pgfmathsetmacroR2 % radius
          pgfmathsetmacromyang50 % latitude angle of the red circle
          coordinate (O) at (0,0,0);
          shade[ball color = blue, opacity = 0.2,tdplot_screen_coords]
          (O) circle [radius = R*1cm];
          beginscope[canvas is xy plane at z=R*sin(myang),transform shape]
          % angVis from https://tex.stackexchange.com/a/49589/121799
          pgfmathsetmacroangVisatan(sin(myang)*cos(tdplotmaintheta)/sin(tdplotmaintheta))
          beginscope[on background layer]
          draw[red,dashed] (angVis:R*cos(myang)) arc (angVis:180-angVis:R*cos(myang));
          endscope
          draw[red] (180-angVis:R*cos(myang)) arc (180-angVis:360+angVis:R*cos(myang));
          path (0:R*cos(myang)) coordinate (R)
          (180:R*cos(myang)) coordinate (L);
          endscope
          beginscope[on background layer]
          draw[dashed] (L) -- (O) node[midway,below] $L$ -- (R);
          fill (O) circle[radius=1pt] node[below] $O$;
          pic[draw,-latex,angle radius=.5cm,angle eccentricity=1.3,"$alpha$"]
          angle=R--O--L;
          endscope
          path[tdplot_screen_coords,pattern=north east lines,pattern color=green!70!black]
          let p1=(L),p2=(R),n1=atan2(y1,x1),n2=atan2(y2,x2)
          in (O) -- (R) arc(n2:n1:R) -- cycle;
          endtikzpicture
          enddocument


          enter image description here



          You can, of course, also add this to your code (which I find a bit more complicated than necessary, but this is only my opinion).



          documentclass[tikz,border=3.14mm]standalone
          usepackagesansmath
          usetikzlibraryquotes,angles,%intersections,%<- not used
          calc,patterns
          begindocument

          begintikzpicture[font = sansmath]
          coordinate (O) at (0,0);



          % ball background color
          shade[ball color = blue, opacity = 0.1] (0,0) circle [radius = 2cm];

          % cone you are not using this anywhere
          % beginscope
          % defrx0.71% horizontal radius of the ellipse
          % defry0.15% vertical radius of the ellipse
          % defz0.725% distance from center of ellipse to origin
          %
          % path [name path global=ellipse] (0,z) ellipse (rx and ry);
          % path [name path = horizontal] (-rx,z-ry*ry/z)
          % -- (rx,z-ry*ry/z);
          %
          %
          %
          % endscope


          % ball
          draw (O) circle [radius=2cm];
          % label of ball center point
          filldraw (O) circle (1pt) node[below] $O$;
          % radius
          draw[densely dashed] (O) to [edge label = $1$] (-1.33,1.33) coordinate (x);
          path[fill=green!70!black,fill opacity=0.5]
          (O) -- (45:2) arc(45:135:2cm) -- cycle;
          draw[densely dashed] (O) -- (1.33,1.33) coordinate (y);

          % cut of ball surface
          draw[red, densely dashed] (-1.36,1.46) arc [start angle = 170, end angle = 10,
          x radius = 13.8mm, y radius = 3.6mm];
          draw[red] (-1.29,1.52) arc [start angle=-200, end angle = 20,
          x radius = 13.75mm, y radius = 3.15mm];

          % label of cut of ball surface
          draw (-1.2,2.2) -- (-0.23,1.1) node at (-1.37,2.37) $B$;

          %angle
          pic[draw,->,angle radius=.5cm,angle eccentricity=1.3,"$alpha$"][blue] angle=y--O--x;
          endtikzpicture
          enddocument


          enter image description here






          share|improve this answer















          Like this?



          documentclass[tikz,border=3.14mm]standalone
          usepackagesansmath
          usepackagetikz-3dplot
          usetikzlibrary3d,backgrounds,quotes,angles,calc,patterns
          begindocument
          tdplotsetmaincoords8000
          begintikzpicture[tdplot_main_coords,font=sansmath]
          pgfmathsetmacroR2 % radius
          pgfmathsetmacromyang50 % latitude angle of the red circle
          coordinate (O) at (0,0,0);
          shade[ball color = blue, opacity = 0.2,tdplot_screen_coords]
          (O) circle [radius = R*1cm];
          beginscope[canvas is xy plane at z=R*sin(myang),transform shape]
          % angVis from https://tex.stackexchange.com/a/49589/121799
          pgfmathsetmacroangVisatan(sin(myang)*cos(tdplotmaintheta)/sin(tdplotmaintheta))
          beginscope[on background layer]
          draw[red,dashed] (angVis:R*cos(myang)) arc (angVis:180-angVis:R*cos(myang));
          endscope
          draw[red] (180-angVis:R*cos(myang)) arc (180-angVis:360+angVis:R*cos(myang));
          path (0:R*cos(myang)) coordinate (R)
          (180:R*cos(myang)) coordinate (L);
          endscope
          beginscope[on background layer]
          draw[dashed] (L) -- (O) node[midway,below] $L$ -- (R);
          fill (O) circle[radius=1pt] node[below] $O$;
          pic[draw,-latex,angle radius=.5cm,angle eccentricity=1.3,"$alpha$"]
          angle=R--O--L;
          endscope
          path[tdplot_screen_coords,pattern=north east lines,pattern color=green!70!black]
          let p1=(L),p2=(R),n1=atan2(y1,x1),n2=atan2(y2,x2)
          in (O) -- (R) arc(n2:n1:R) -- cycle;
          endtikzpicture
          enddocument


          enter image description here



          You can, of course, also add this to your code (which I find a bit more complicated than necessary, but this is only my opinion).



          documentclass[tikz,border=3.14mm]standalone
          usepackagesansmath
          usetikzlibraryquotes,angles,%intersections,%<- not used
          calc,patterns
          begindocument

          begintikzpicture[font = sansmath]
          coordinate (O) at (0,0);



          % ball background color
          shade[ball color = blue, opacity = 0.1] (0,0) circle [radius = 2cm];

          % cone you are not using this anywhere
          % beginscope
          % defrx0.71% horizontal radius of the ellipse
          % defry0.15% vertical radius of the ellipse
          % defz0.725% distance from center of ellipse to origin
          %
          % path [name path global=ellipse] (0,z) ellipse (rx and ry);
          % path [name path = horizontal] (-rx,z-ry*ry/z)
          % -- (rx,z-ry*ry/z);
          %
          %
          %
          % endscope


          % ball
          draw (O) circle [radius=2cm];
          % label of ball center point
          filldraw (O) circle (1pt) node[below] $O$;
          % radius
          draw[densely dashed] (O) to [edge label = $1$] (-1.33,1.33) coordinate (x);
          path[fill=green!70!black,fill opacity=0.5]
          (O) -- (45:2) arc(45:135:2cm) -- cycle;
          draw[densely dashed] (O) -- (1.33,1.33) coordinate (y);

          % cut of ball surface
          draw[red, densely dashed] (-1.36,1.46) arc [start angle = 170, end angle = 10,
          x radius = 13.8mm, y radius = 3.6mm];
          draw[red] (-1.29,1.52) arc [start angle=-200, end angle = 20,
          x radius = 13.75mm, y radius = 3.15mm];

          % label of cut of ball surface
          draw (-1.2,2.2) -- (-0.23,1.1) node at (-1.37,2.37) $B$;

          %angle
          pic[draw,->,angle radius=.5cm,angle eccentricity=1.3,"$alpha$"][blue] angle=y--O--x;
          endtikzpicture
          enddocument


          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 56 mins ago

























          answered 1 hour ago









          marmotmarmot

          116k5147277




          116k5147277












          • Perfect! If I wanted to have it completely green and not shaded, I'd only need to replace your code with fill right?

            – medihde
            59 mins ago











          • @medihde Yes. You may need to change the ordering in order not to overwrite the angle etc. I added a proposal.

            – marmot
            58 mins ago


















          • Perfect! If I wanted to have it completely green and not shaded, I'd only need to replace your code with fill right?

            – medihde
            59 mins ago











          • @medihde Yes. You may need to change the ordering in order not to overwrite the angle etc. I added a proposal.

            – marmot
            58 mins ago

















          Perfect! If I wanted to have it completely green and not shaded, I'd only need to replace your code with fill right?

          – medihde
          59 mins ago





          Perfect! If I wanted to have it completely green and not shaded, I'd only need to replace your code with fill right?

          – medihde
          59 mins ago













          @medihde Yes. You may need to change the ordering in order not to overwrite the angle etc. I added a proposal.

          – marmot
          58 mins ago






          @medihde Yes. You may need to change the ordering in order not to overwrite the angle etc. I added a proposal.

          – marmot
          58 mins ago











          medihde is a new contributor. Be nice, and check out our Code of Conduct.









          draft saved

          draft discarded


















          medihde is a new contributor. Be nice, and check out our Code of Conduct.












          medihde is a new contributor. Be nice, and check out our Code of Conduct.











          medihde is a new contributor. Be nice, and check out our Code of Conduct.














          Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f483849%2fdraw-a-calotte-within-a-sphere%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          acmart: Multiple authors: all with same affiliation, one author an additional affiliationHow to Write Names of Multiple Authors with Shared Affiliation in ACM 2017 Template?Multiple authors with different primary affiliation, but same additional affiliationSame affiliation for all authors without extra packagesIOS-Book-Article.cls: one author with multiple affiliationacmart: Shared Author AffiliationMultiple authors with different primary affiliation, but same additional affiliationAuthor affiliation with only 1 authorAdding Multiple Authors with Different Affiliation in LaTeX ArticleLaTeX: Multiple authors stays on same lineHow to Label Multiple Authors with Same DescriptionHow to make two authors use the same affiliationTwo authors with same affiliation on finished front page

          How to write “ä” and other umlauts and accented letters in bibliography?Accents in BibTeXSorting references with special characters alphabeticallyUse ae ligature in bibliographyEastern European nameInverted circumflex in BibTexBibTex, non-ascii initials and nameptr fproblems with accent in LatexHow to add a Ø to my bibliography from Jabref?References without accentsTroubles when trying to cite St“omer-Verlet in ”title" field of a bib entryComprehensive list of accented charactersHow to type the letter “i” with two dots (diaeresis) in math mode?Problem with glossary text and accented lettersSpecial character in bibliographyAccented letters, Unicode and LaTeX accentsHow to stop natbib from modifying bibliography styleCitation of a paper with non-standard characters by BibtexWrite accented characters to file using writeHow to group the bibliography alphabetically, if some surnames start with “accented” characters?How can I automatically capitalize significant words in my bibliography?

          How to remove border form elements in the last row?Targeting flex items on the last rowHow to vertically wrap content with flexbox?Remove border from IFrameCSS3's border-radius property and border-collapse:collapse don't mix. How can I use border-radius to create a collapsed table with rounded corners?Div width 100% minus fixed amount of pixelsBorder around specific rows in a table?How to remove border (outline) around text/input boxes? (Chrome)How do I remove the space between inline-block elements?Flex-box: Align last row to gridRemove blue border from css custom-styled button in ChromeFill remaining vertical space with CSS using display:flexhow style elements in the last row of flexbox row layout with pure css without js