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
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:

I've tried fiddling with shade to no success.
tikz-pgf
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.
add a comment |
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:

I've tried fiddling with shade to no success.
tikz-pgf
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.
add a comment |
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:

I've tried fiddling with shade to no success.
tikz-pgf
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:

I've tried fiddling with shade to no success.
tikz-pgf
tikz-pgf
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.
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.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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

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

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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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

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

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
add a comment |
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

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

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
add a comment |
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

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

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

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

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
add a comment |
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
add a comment |
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.
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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