Tikzpicture - finish drawing a curved line for a cake sliceHow to draw the following diagram (a wedge of cheese) using pgfplots or tikz?TikZ: Cropping the Bounding BoxRotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?TikZ/ERD: node (=Entity) label on the insideTikZ: Drawing an arc from an intersection to an intersectionRecommended tools for vector drawingLine up nested tikz enviroments or how to get rid of themDrawing Curved Arrow Using TikzDrawing a vertical line with sectionstikzpicture curved arrows
Why don't we shield existing CPUs from radiation instead of designing new ones?
Continuous functions taking uncountably many values countably often
Minimum age of קידושין for a female?
A major investor asked me (the software lead) whether the board should fire my boss (the Co-Founder and CTO). What should I do?
Should I turn off kernel logging (and how?) if I'm running off an SSD?
Personal item size
Why does the media continue to hide the identity of the Trump-Ukraine whistle blower when they have already been outed?
A feasible and efficient method of fast global travel?
Why can "bubo" ("owl") be feminine or masculine?
List of valid keys for sfdx-config.json?
Is 忍者/忍び also used for women?
Intersection of four circles
What color is a wolf's coat?
Heavy condensation inside car during winter. Tried multiple things, but no results!
How to translate "cocotte en papier" in English?
Where do I put nobles/royalty in a science fiction military?
Single Player Python Battleship Game
Why do some applications have files with no extension?
Plot the Pascalian triangle
Why do airline tickets have titles in addition to names?
How do HK restaurants keep white scallops that they wok fry? No sear marks!
Where and/or why is a slanted hyphen used?
Should I not drive with this huge chipped rim?
Why is this claimed dereferencing type-punned pointer warning compiler-specific?
Tikzpicture - finish drawing a curved line for a cake slice
How to draw the following diagram (a wedge of cheese) using pgfplots or tikz?TikZ: Cropping the Bounding BoxRotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?TikZ/ERD: node (=Entity) label on the insideTikZ: Drawing an arc from an intersection to an intersectionRecommended tools for vector drawingLine up nested tikz enviroments or how to get rid of themDrawing Curved Arrow Using TikzDrawing a vertical line with sectionstikzpicture curved arrows
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;
As described above, I want to draw the finishing touch by drawing the blue, curved line so that the finished image looks like a slice of a cake.
Thank you.
What I have so far:
documentclass[]article
usepackage[margin=0.5in]geometry
usepackagepgfplots
renewcommandthesectionarabicsection
usepackagemathtools
usepackagecancel
usepackagepgfplots
usepackageamsmath
newtheoremtheoremTHEOREM
newtheoremproofPROOF
usepackagetikz
usepackageamssymb
usetikzlibrarypatterns
usepackagefancyhdr
usepackagebigints
usepackagecolor
usepackagetcolorbox
usepackagecolor,xcolor
usepackagebooktabs,array
usepackagehyperref
usepackagegraphicx
usetikzlibraryarrows
usepackagepolynom
usepackageflexisym
usepackagewallpaper
usepackageblkarray
usepackagecaption
usepackagelscape
usepgfplotslibraryfillbetween
usepgfplotslibrarystatistics
usetikzlibraryshapes.misc
usetikzlibraryarrows.meta
newenvironmenttightcenter
setlengthtopsep0pt
setlengthparskip0pt
begincenterendcenter
begindocument
begintikzpicture
%draw[thick] (0,0) circle (4.5cm);
%draw[fill=black] (0,0) circle (0.3mm);
%node[below] at (0,0)$O$;
%node[below] at (1.25,0.9)$2$ cm;
%node[below] at (-0.9,0.9)$2$ cm;
%
%draw[thick,color=black,fill=gray!30] (0,0) -- (120:4.5) arc(120:45:4.5) -- cycle;
draw[thick,color=black,fill=gray!30] (0,0) -- (-20:4.5) arc(-20:-50:4.5) -- cycle;
draw[thick,color=blue!30] (-35.5:5.2) arc(-35.5:-60:5.2);
draw[thick,color=black] (4.23,-1.55) -- (4.23,-3.52);
draw[thick,color=black] (2.9,-3.43) -- (2.9,-4.67);
draw[thick,color=black] (0,0) -- (0,-1.04)-- (2.9,-4.67);
%
%draw [thick,<->] (0.28,-0.4) -- node[fill=white] small $2$ textcm (2.12,1.33);
%draw [thick,<->] (-0.5,-0.3) -- node[fill=white] small $2$ textcm (-1.73,1.83);
%
endtikzpicture
enddocument
tikz-pgf technical-drawing
add a comment
|
As described above, I want to draw the finishing touch by drawing the blue, curved line so that the finished image looks like a slice of a cake.
Thank you.
What I have so far:
documentclass[]article
usepackage[margin=0.5in]geometry
usepackagepgfplots
renewcommandthesectionarabicsection
usepackagemathtools
usepackagecancel
usepackagepgfplots
usepackageamsmath
newtheoremtheoremTHEOREM
newtheoremproofPROOF
usepackagetikz
usepackageamssymb
usetikzlibrarypatterns
usepackagefancyhdr
usepackagebigints
usepackagecolor
usepackagetcolorbox
usepackagecolor,xcolor
usepackagebooktabs,array
usepackagehyperref
usepackagegraphicx
usetikzlibraryarrows
usepackagepolynom
usepackageflexisym
usepackagewallpaper
usepackageblkarray
usepackagecaption
usepackagelscape
usepgfplotslibraryfillbetween
usepgfplotslibrarystatistics
usetikzlibraryshapes.misc
usetikzlibraryarrows.meta
newenvironmenttightcenter
setlengthtopsep0pt
setlengthparskip0pt
begincenterendcenter
begindocument
begintikzpicture
%draw[thick] (0,0) circle (4.5cm);
%draw[fill=black] (0,0) circle (0.3mm);
%node[below] at (0,0)$O$;
%node[below] at (1.25,0.9)$2$ cm;
%node[below] at (-0.9,0.9)$2$ cm;
%
%draw[thick,color=black,fill=gray!30] (0,0) -- (120:4.5) arc(120:45:4.5) -- cycle;
draw[thick,color=black,fill=gray!30] (0,0) -- (-20:4.5) arc(-20:-50:4.5) -- cycle;
draw[thick,color=blue!30] (-35.5:5.2) arc(-35.5:-60:5.2);
draw[thick,color=black] (4.23,-1.55) -- (4.23,-3.52);
draw[thick,color=black] (2.9,-3.43) -- (2.9,-4.67);
draw[thick,color=black] (0,0) -- (0,-1.04)-- (2.9,-4.67);
%
%draw [thick,<->] (0.28,-0.4) -- node[fill=white] small $2$ textcm (2.12,1.33);
%draw [thick,<->] (-0.5,-0.3) -- node[fill=white] small $2$ textcm (-1.73,1.83);
%
endtikzpicture
enddocument
tikz-pgf technical-drawing
1
Hello and welcome. Please remove all unused packages from your code.
– AndréC
Aug 11 at 9:02
Off-topic:hyperref
package should be last in preamble.
– Zarko
Aug 11 at 9:06
@Zarko could you explain why?
– Julian Zucker
Aug 11 at 19:24
@JulianZucker, becausehyperref
for its proper work redefine some other packages internals. If you load those package after it, than their internals overwrite those redefinition and with this nullify necessary changes done byhyperref
. See its documentation.
– Zarko
Aug 11 at 19:36
Wonderful, thanks!
– Julian Zucker
Aug 11 at 19:39
add a comment
|
As described above, I want to draw the finishing touch by drawing the blue, curved line so that the finished image looks like a slice of a cake.
Thank you.
What I have so far:
documentclass[]article
usepackage[margin=0.5in]geometry
usepackagepgfplots
renewcommandthesectionarabicsection
usepackagemathtools
usepackagecancel
usepackagepgfplots
usepackageamsmath
newtheoremtheoremTHEOREM
newtheoremproofPROOF
usepackagetikz
usepackageamssymb
usetikzlibrarypatterns
usepackagefancyhdr
usepackagebigints
usepackagecolor
usepackagetcolorbox
usepackagecolor,xcolor
usepackagebooktabs,array
usepackagehyperref
usepackagegraphicx
usetikzlibraryarrows
usepackagepolynom
usepackageflexisym
usepackagewallpaper
usepackageblkarray
usepackagecaption
usepackagelscape
usepgfplotslibraryfillbetween
usepgfplotslibrarystatistics
usetikzlibraryshapes.misc
usetikzlibraryarrows.meta
newenvironmenttightcenter
setlengthtopsep0pt
setlengthparskip0pt
begincenterendcenter
begindocument
begintikzpicture
%draw[thick] (0,0) circle (4.5cm);
%draw[fill=black] (0,0) circle (0.3mm);
%node[below] at (0,0)$O$;
%node[below] at (1.25,0.9)$2$ cm;
%node[below] at (-0.9,0.9)$2$ cm;
%
%draw[thick,color=black,fill=gray!30] (0,0) -- (120:4.5) arc(120:45:4.5) -- cycle;
draw[thick,color=black,fill=gray!30] (0,0) -- (-20:4.5) arc(-20:-50:4.5) -- cycle;
draw[thick,color=blue!30] (-35.5:5.2) arc(-35.5:-60:5.2);
draw[thick,color=black] (4.23,-1.55) -- (4.23,-3.52);
draw[thick,color=black] (2.9,-3.43) -- (2.9,-4.67);
draw[thick,color=black] (0,0) -- (0,-1.04)-- (2.9,-4.67);
%
%draw [thick,<->] (0.28,-0.4) -- node[fill=white] small $2$ textcm (2.12,1.33);
%draw [thick,<->] (-0.5,-0.3) -- node[fill=white] small $2$ textcm (-1.73,1.83);
%
endtikzpicture
enddocument
tikz-pgf technical-drawing
As described above, I want to draw the finishing touch by drawing the blue, curved line so that the finished image looks like a slice of a cake.
Thank you.
What I have so far:
documentclass[]article
usepackage[margin=0.5in]geometry
usepackagepgfplots
renewcommandthesectionarabicsection
usepackagemathtools
usepackagecancel
usepackagepgfplots
usepackageamsmath
newtheoremtheoremTHEOREM
newtheoremproofPROOF
usepackagetikz
usepackageamssymb
usetikzlibrarypatterns
usepackagefancyhdr
usepackagebigints
usepackagecolor
usepackagetcolorbox
usepackagecolor,xcolor
usepackagebooktabs,array
usepackagehyperref
usepackagegraphicx
usetikzlibraryarrows
usepackagepolynom
usepackageflexisym
usepackagewallpaper
usepackageblkarray
usepackagecaption
usepackagelscape
usepgfplotslibraryfillbetween
usepgfplotslibrarystatistics
usetikzlibraryshapes.misc
usetikzlibraryarrows.meta
newenvironmenttightcenter
setlengthtopsep0pt
setlengthparskip0pt
begincenterendcenter
begindocument
begintikzpicture
%draw[thick] (0,0) circle (4.5cm);
%draw[fill=black] (0,0) circle (0.3mm);
%node[below] at (0,0)$O$;
%node[below] at (1.25,0.9)$2$ cm;
%node[below] at (-0.9,0.9)$2$ cm;
%
%draw[thick,color=black,fill=gray!30] (0,0) -- (120:4.5) arc(120:45:4.5) -- cycle;
draw[thick,color=black,fill=gray!30] (0,0) -- (-20:4.5) arc(-20:-50:4.5) -- cycle;
draw[thick,color=blue!30] (-35.5:5.2) arc(-35.5:-60:5.2);
draw[thick,color=black] (4.23,-1.55) -- (4.23,-3.52);
draw[thick,color=black] (2.9,-3.43) -- (2.9,-4.67);
draw[thick,color=black] (0,0) -- (0,-1.04)-- (2.9,-4.67);
%
%draw [thick,<->] (0.28,-0.4) -- node[fill=white] small $2$ textcm (2.12,1.33);
%draw [thick,<->] (-0.5,-0.3) -- node[fill=white] small $2$ textcm (-1.73,1.83);
%
endtikzpicture
enddocument
tikz-pgf technical-drawing
tikz-pgf technical-drawing
edited Aug 11 at 9:22
AndréC
13.9k2 gold badges18 silver badges59 bronze badges
13.9k2 gold badges18 silver badges59 bronze badges
asked Aug 11 at 8:51
Will KimWill Kim
8998 silver badges19 bronze badges
8998 silver badges19 bronze badges
1
Hello and welcome. Please remove all unused packages from your code.
– AndréC
Aug 11 at 9:02
Off-topic:hyperref
package should be last in preamble.
– Zarko
Aug 11 at 9:06
@Zarko could you explain why?
– Julian Zucker
Aug 11 at 19:24
@JulianZucker, becausehyperref
for its proper work redefine some other packages internals. If you load those package after it, than their internals overwrite those redefinition and with this nullify necessary changes done byhyperref
. See its documentation.
– Zarko
Aug 11 at 19:36
Wonderful, thanks!
– Julian Zucker
Aug 11 at 19:39
add a comment
|
1
Hello and welcome. Please remove all unused packages from your code.
– AndréC
Aug 11 at 9:02
Off-topic:hyperref
package should be last in preamble.
– Zarko
Aug 11 at 9:06
@Zarko could you explain why?
– Julian Zucker
Aug 11 at 19:24
@JulianZucker, becausehyperref
for its proper work redefine some other packages internals. If you load those package after it, than their internals overwrite those redefinition and with this nullify necessary changes done byhyperref
. See its documentation.
– Zarko
Aug 11 at 19:36
Wonderful, thanks!
– Julian Zucker
Aug 11 at 19:39
1
1
Hello and welcome. Please remove all unused packages from your code.
– AndréC
Aug 11 at 9:02
Hello and welcome. Please remove all unused packages from your code.
– AndréC
Aug 11 at 9:02
Off-topic:
hyperref
package should be last in preamble.– Zarko
Aug 11 at 9:06
Off-topic:
hyperref
package should be last in preamble.– Zarko
Aug 11 at 9:06
@Zarko could you explain why?
– Julian Zucker
Aug 11 at 19:24
@Zarko could you explain why?
– Julian Zucker
Aug 11 at 19:24
@JulianZucker, because
hyperref
for its proper work redefine some other packages internals. If you load those package after it, than their internals overwrite those redefinition and with this nullify necessary changes done by hyperref
. See its documentation.– Zarko
Aug 11 at 19:36
@JulianZucker, because
hyperref
for its proper work redefine some other packages internals. If you load those package after it, than their internals overwrite those redefinition and with this nullify necessary changes done by hyperref
. See its documentation.– Zarko
Aug 11 at 19:36
Wonderful, thanks!
– Julian Zucker
Aug 11 at 19:39
Wonderful, thanks!
– Julian Zucker
Aug 11 at 19:39
add a comment
|
3 Answers
3
active
oldest
votes
Like this ?
To avoid having to manually calculate the coordinates of the points, I use the relative positioning of the points with the syntax --++
.
This syntax indicates that to obtain the coordinates of the next point, we add the preceding point (0,-1.24)
(4.23,-1.55) --++ (0,-1.24)
is equivalent to
(4.23,-1.55) -- (4.23,-2.79)
indeed 4.23 + 0 = 4.23
and -1.55 + (-1.24) = -2.79
documentclass[tikz,border=5mm]standalone
begindocument
begintikzpicture
draw[thick,color=black,fill=gray!30] (0,0) -- (-20:4.5) arc(-20:-50:4.5) -- cycle;
draw[thick,color=black,yshift=-1.24cm] (-20:4.5) arc(-20:-50:4.5) -- (0,0);
draw[thick,color=black] (4.23,-1.55) --++ (0,-1.24);
draw[thick,color=black] (2.9,-3.43) --++ (0,-1.24);
draw[thick,color=black] (0,0) --++ (0,-1.24);
endtikzpicture
enddocument
Looks beautiful. Thank you so much!
– Will Kim
Aug 11 at 9:22
Good, I'll add the explanations so you can understand better.
– AndréC
Aug 11 at 9:24
1
Please, can I have a piece of cake :-) ahahahah?
– Sebastiano
Aug 12 at 7:04
add a comment
|
If you use tikz-3dplot
, you do not have to guess the curves, and you can adjust the view angles at will.
documentclass[tikz,border=3.14mm]standalone
usepackagetikz-3dplot
begindocument
tdplotsetmaincoords7560
begintikzpicture[tdplot_main_coords]
beginscope[canvas is xy plane at z=0,name prefix=bot-]
draw (0,0) coordinate (O) -- (4,0) coordinate (A) arc (0:60:4) coordinate
(B);
endscope
beginscope[canvas is xy plane at z=2,name prefix=top-]
draw[fill=blue!20] (0,0) coordinate (O) -- (4,0) coordinate (A) arc (0:60:4) coordinate
(B) -- cycle;
endscope
draw foreach X in O,A,B
(bot-X) -- (top-X);
endtikzpicture
enddocument
documentclass[tikz,border=3.14mm]standalone
usepackagetikz-3dplot
begindocument
foreach X in 89,88,...,60,61,62,...,88
tdplotsetmaincoords70+10*sin(6*X)X
pgfmathsetmacroxmin0
pgfmathsetmacroxmax0
pgfmathsetmacroymin0
pgfmathsetmacroymax0
begintikzpicture[tdplot_main_coords]
ifdefinedfigbbrelax
path figbb;
fi
beginscope[canvas is xy plane at z=0,name prefix=bot-]
draw (0,0) coordinate (O) -- (4,0) coordinate (A) arc (0:60:4) coordinate
(B);
endscope
beginscope[canvas is xy plane at z=2,name prefix=top-]
draw[fill=blue!20] (0,0) coordinate (O) -- (4,0) coordinate (A) arc (0:60:4) coordinate
(B) -- cycle;
endscope
draw foreach X in O,A,B (bot-X) -- (top-X);
path let p1=(current bounding box.south west),
p2=(current bounding box.north east)
in pgfextra%
pgfmathsetmacroxminmin(x1,xmin)
pgfmathsetmacroxmaxmax(x2,xmax)
pgfmathsetmacroyminmin(y1,ymin)
pgfmathsetmacroymaxmax(y2,ymax)
xdefxminxmin pt
xdefxmaxxmax pt
xdefyminymin pt
xdefymaxymax pt
;
endtikzpicture
makeatletter
edeffigbb(xmin,ymin) rectangle (xmax,ymax)
immediatewrite@mainauxxdefstringfigbbfigbbrelax
makeatother
enddocument
If you want to allow for arbitrary view angles, you need to distinguish some cases as in this answer which provides you with the rest of the (cheese) cake (except for the piece stolen by the mouse;-).
add a comment
|
One more example: In the drawing, angles are considered in reverse order. For vertical lines, the coordinate is defined, so that only one coordinate now is necessary to determine of height of slice:
documentclass[tikz, margin=3mm]standalone
begindocument
begintikzpicture[
every path/.style = thick, line join=round % style of lines
]
draw[fill=gray!30] (0, 0) -- (-50:4.5) coordinate (a1) arc(-50:-20:4.5) coordinate (a2) -- cycle;
draw (0,0) -- (0,-2) % determine height of slice
-- ++(-50:4.5) coordinate (b1) arc(-50:-20:4.5) coordinate (b2);
draw (a1) -- (b1) (a2) -- (b2);
endtikzpicture
enddocument
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/4.0/"u003ecc by-sa 4.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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
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%2f503755%2ftikzpicture-finish-drawing-a-curved-line-for-a-cake-slice%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Like this ?
To avoid having to manually calculate the coordinates of the points, I use the relative positioning of the points with the syntax --++
.
This syntax indicates that to obtain the coordinates of the next point, we add the preceding point (0,-1.24)
(4.23,-1.55) --++ (0,-1.24)
is equivalent to
(4.23,-1.55) -- (4.23,-2.79)
indeed 4.23 + 0 = 4.23
and -1.55 + (-1.24) = -2.79
documentclass[tikz,border=5mm]standalone
begindocument
begintikzpicture
draw[thick,color=black,fill=gray!30] (0,0) -- (-20:4.5) arc(-20:-50:4.5) -- cycle;
draw[thick,color=black,yshift=-1.24cm] (-20:4.5) arc(-20:-50:4.5) -- (0,0);
draw[thick,color=black] (4.23,-1.55) --++ (0,-1.24);
draw[thick,color=black] (2.9,-3.43) --++ (0,-1.24);
draw[thick,color=black] (0,0) --++ (0,-1.24);
endtikzpicture
enddocument
Looks beautiful. Thank you so much!
– Will Kim
Aug 11 at 9:22
Good, I'll add the explanations so you can understand better.
– AndréC
Aug 11 at 9:24
1
Please, can I have a piece of cake :-) ahahahah?
– Sebastiano
Aug 12 at 7:04
add a comment
|
Like this ?
To avoid having to manually calculate the coordinates of the points, I use the relative positioning of the points with the syntax --++
.
This syntax indicates that to obtain the coordinates of the next point, we add the preceding point (0,-1.24)
(4.23,-1.55) --++ (0,-1.24)
is equivalent to
(4.23,-1.55) -- (4.23,-2.79)
indeed 4.23 + 0 = 4.23
and -1.55 + (-1.24) = -2.79
documentclass[tikz,border=5mm]standalone
begindocument
begintikzpicture
draw[thick,color=black,fill=gray!30] (0,0) -- (-20:4.5) arc(-20:-50:4.5) -- cycle;
draw[thick,color=black,yshift=-1.24cm] (-20:4.5) arc(-20:-50:4.5) -- (0,0);
draw[thick,color=black] (4.23,-1.55) --++ (0,-1.24);
draw[thick,color=black] (2.9,-3.43) --++ (0,-1.24);
draw[thick,color=black] (0,0) --++ (0,-1.24);
endtikzpicture
enddocument
Looks beautiful. Thank you so much!
– Will Kim
Aug 11 at 9:22
Good, I'll add the explanations so you can understand better.
– AndréC
Aug 11 at 9:24
1
Please, can I have a piece of cake :-) ahahahah?
– Sebastiano
Aug 12 at 7:04
add a comment
|
Like this ?
To avoid having to manually calculate the coordinates of the points, I use the relative positioning of the points with the syntax --++
.
This syntax indicates that to obtain the coordinates of the next point, we add the preceding point (0,-1.24)
(4.23,-1.55) --++ (0,-1.24)
is equivalent to
(4.23,-1.55) -- (4.23,-2.79)
indeed 4.23 + 0 = 4.23
and -1.55 + (-1.24) = -2.79
documentclass[tikz,border=5mm]standalone
begindocument
begintikzpicture
draw[thick,color=black,fill=gray!30] (0,0) -- (-20:4.5) arc(-20:-50:4.5) -- cycle;
draw[thick,color=black,yshift=-1.24cm] (-20:4.5) arc(-20:-50:4.5) -- (0,0);
draw[thick,color=black] (4.23,-1.55) --++ (0,-1.24);
draw[thick,color=black] (2.9,-3.43) --++ (0,-1.24);
draw[thick,color=black] (0,0) --++ (0,-1.24);
endtikzpicture
enddocument
Like this ?
To avoid having to manually calculate the coordinates of the points, I use the relative positioning of the points with the syntax --++
.
This syntax indicates that to obtain the coordinates of the next point, we add the preceding point (0,-1.24)
(4.23,-1.55) --++ (0,-1.24)
is equivalent to
(4.23,-1.55) -- (4.23,-2.79)
indeed 4.23 + 0 = 4.23
and -1.55 + (-1.24) = -2.79
documentclass[tikz,border=5mm]standalone
begindocument
begintikzpicture
draw[thick,color=black,fill=gray!30] (0,0) -- (-20:4.5) arc(-20:-50:4.5) -- cycle;
draw[thick,color=black,yshift=-1.24cm] (-20:4.5) arc(-20:-50:4.5) -- (0,0);
draw[thick,color=black] (4.23,-1.55) --++ (0,-1.24);
draw[thick,color=black] (2.9,-3.43) --++ (0,-1.24);
draw[thick,color=black] (0,0) --++ (0,-1.24);
endtikzpicture
enddocument
edited Aug 11 at 9:30
answered Aug 11 at 9:21
AndréCAndréC
13.9k2 gold badges18 silver badges59 bronze badges
13.9k2 gold badges18 silver badges59 bronze badges
Looks beautiful. Thank you so much!
– Will Kim
Aug 11 at 9:22
Good, I'll add the explanations so you can understand better.
– AndréC
Aug 11 at 9:24
1
Please, can I have a piece of cake :-) ahahahah?
– Sebastiano
Aug 12 at 7:04
add a comment
|
Looks beautiful. Thank you so much!
– Will Kim
Aug 11 at 9:22
Good, I'll add the explanations so you can understand better.
– AndréC
Aug 11 at 9:24
1
Please, can I have a piece of cake :-) ahahahah?
– Sebastiano
Aug 12 at 7:04
Looks beautiful. Thank you so much!
– Will Kim
Aug 11 at 9:22
Looks beautiful. Thank you so much!
– Will Kim
Aug 11 at 9:22
Good, I'll add the explanations so you can understand better.
– AndréC
Aug 11 at 9:24
Good, I'll add the explanations so you can understand better.
– AndréC
Aug 11 at 9:24
1
1
Please, can I have a piece of cake :-) ahahahah?
– Sebastiano
Aug 12 at 7:04
Please, can I have a piece of cake :-) ahahahah?
– Sebastiano
Aug 12 at 7:04
add a comment
|
If you use tikz-3dplot
, you do not have to guess the curves, and you can adjust the view angles at will.
documentclass[tikz,border=3.14mm]standalone
usepackagetikz-3dplot
begindocument
tdplotsetmaincoords7560
begintikzpicture[tdplot_main_coords]
beginscope[canvas is xy plane at z=0,name prefix=bot-]
draw (0,0) coordinate (O) -- (4,0) coordinate (A) arc (0:60:4) coordinate
(B);
endscope
beginscope[canvas is xy plane at z=2,name prefix=top-]
draw[fill=blue!20] (0,0) coordinate (O) -- (4,0) coordinate (A) arc (0:60:4) coordinate
(B) -- cycle;
endscope
draw foreach X in O,A,B
(bot-X) -- (top-X);
endtikzpicture
enddocument
documentclass[tikz,border=3.14mm]standalone
usepackagetikz-3dplot
begindocument
foreach X in 89,88,...,60,61,62,...,88
tdplotsetmaincoords70+10*sin(6*X)X
pgfmathsetmacroxmin0
pgfmathsetmacroxmax0
pgfmathsetmacroymin0
pgfmathsetmacroymax0
begintikzpicture[tdplot_main_coords]
ifdefinedfigbbrelax
path figbb;
fi
beginscope[canvas is xy plane at z=0,name prefix=bot-]
draw (0,0) coordinate (O) -- (4,0) coordinate (A) arc (0:60:4) coordinate
(B);
endscope
beginscope[canvas is xy plane at z=2,name prefix=top-]
draw[fill=blue!20] (0,0) coordinate (O) -- (4,0) coordinate (A) arc (0:60:4) coordinate
(B) -- cycle;
endscope
draw foreach X in O,A,B (bot-X) -- (top-X);
path let p1=(current bounding box.south west),
p2=(current bounding box.north east)
in pgfextra%
pgfmathsetmacroxminmin(x1,xmin)
pgfmathsetmacroxmaxmax(x2,xmax)
pgfmathsetmacroyminmin(y1,ymin)
pgfmathsetmacroymaxmax(y2,ymax)
xdefxminxmin pt
xdefxmaxxmax pt
xdefyminymin pt
xdefymaxymax pt
;
endtikzpicture
makeatletter
edeffigbb(xmin,ymin) rectangle (xmax,ymax)
immediatewrite@mainauxxdefstringfigbbfigbbrelax
makeatother
enddocument
If you want to allow for arbitrary view angles, you need to distinguish some cases as in this answer which provides you with the rest of the (cheese) cake (except for the piece stolen by the mouse;-).
add a comment
|
If you use tikz-3dplot
, you do not have to guess the curves, and you can adjust the view angles at will.
documentclass[tikz,border=3.14mm]standalone
usepackagetikz-3dplot
begindocument
tdplotsetmaincoords7560
begintikzpicture[tdplot_main_coords]
beginscope[canvas is xy plane at z=0,name prefix=bot-]
draw (0,0) coordinate (O) -- (4,0) coordinate (A) arc (0:60:4) coordinate
(B);
endscope
beginscope[canvas is xy plane at z=2,name prefix=top-]
draw[fill=blue!20] (0,0) coordinate (O) -- (4,0) coordinate (A) arc (0:60:4) coordinate
(B) -- cycle;
endscope
draw foreach X in O,A,B
(bot-X) -- (top-X);
endtikzpicture
enddocument
documentclass[tikz,border=3.14mm]standalone
usepackagetikz-3dplot
begindocument
foreach X in 89,88,...,60,61,62,...,88
tdplotsetmaincoords70+10*sin(6*X)X
pgfmathsetmacroxmin0
pgfmathsetmacroxmax0
pgfmathsetmacroymin0
pgfmathsetmacroymax0
begintikzpicture[tdplot_main_coords]
ifdefinedfigbbrelax
path figbb;
fi
beginscope[canvas is xy plane at z=0,name prefix=bot-]
draw (0,0) coordinate (O) -- (4,0) coordinate (A) arc (0:60:4) coordinate
(B);
endscope
beginscope[canvas is xy plane at z=2,name prefix=top-]
draw[fill=blue!20] (0,0) coordinate (O) -- (4,0) coordinate (A) arc (0:60:4) coordinate
(B) -- cycle;
endscope
draw foreach X in O,A,B (bot-X) -- (top-X);
path let p1=(current bounding box.south west),
p2=(current bounding box.north east)
in pgfextra%
pgfmathsetmacroxminmin(x1,xmin)
pgfmathsetmacroxmaxmax(x2,xmax)
pgfmathsetmacroyminmin(y1,ymin)
pgfmathsetmacroymaxmax(y2,ymax)
xdefxminxmin pt
xdefxmaxxmax pt
xdefyminymin pt
xdefymaxymax pt
;
endtikzpicture
makeatletter
edeffigbb(xmin,ymin) rectangle (xmax,ymax)
immediatewrite@mainauxxdefstringfigbbfigbbrelax
makeatother
enddocument
If you want to allow for arbitrary view angles, you need to distinguish some cases as in this answer which provides you with the rest of the (cheese) cake (except for the piece stolen by the mouse;-).
add a comment
|
If you use tikz-3dplot
, you do not have to guess the curves, and you can adjust the view angles at will.
documentclass[tikz,border=3.14mm]standalone
usepackagetikz-3dplot
begindocument
tdplotsetmaincoords7560
begintikzpicture[tdplot_main_coords]
beginscope[canvas is xy plane at z=0,name prefix=bot-]
draw (0,0) coordinate (O) -- (4,0) coordinate (A) arc (0:60:4) coordinate
(B);
endscope
beginscope[canvas is xy plane at z=2,name prefix=top-]
draw[fill=blue!20] (0,0) coordinate (O) -- (4,0) coordinate (A) arc (0:60:4) coordinate
(B) -- cycle;
endscope
draw foreach X in O,A,B
(bot-X) -- (top-X);
endtikzpicture
enddocument
documentclass[tikz,border=3.14mm]standalone
usepackagetikz-3dplot
begindocument
foreach X in 89,88,...,60,61,62,...,88
tdplotsetmaincoords70+10*sin(6*X)X
pgfmathsetmacroxmin0
pgfmathsetmacroxmax0
pgfmathsetmacroymin0
pgfmathsetmacroymax0
begintikzpicture[tdplot_main_coords]
ifdefinedfigbbrelax
path figbb;
fi
beginscope[canvas is xy plane at z=0,name prefix=bot-]
draw (0,0) coordinate (O) -- (4,0) coordinate (A) arc (0:60:4) coordinate
(B);
endscope
beginscope[canvas is xy plane at z=2,name prefix=top-]
draw[fill=blue!20] (0,0) coordinate (O) -- (4,0) coordinate (A) arc (0:60:4) coordinate
(B) -- cycle;
endscope
draw foreach X in O,A,B (bot-X) -- (top-X);
path let p1=(current bounding box.south west),
p2=(current bounding box.north east)
in pgfextra%
pgfmathsetmacroxminmin(x1,xmin)
pgfmathsetmacroxmaxmax(x2,xmax)
pgfmathsetmacroyminmin(y1,ymin)
pgfmathsetmacroymaxmax(y2,ymax)
xdefxminxmin pt
xdefxmaxxmax pt
xdefyminymin pt
xdefymaxymax pt
;
endtikzpicture
makeatletter
edeffigbb(xmin,ymin) rectangle (xmax,ymax)
immediatewrite@mainauxxdefstringfigbbfigbbrelax
makeatother
enddocument
If you want to allow for arbitrary view angles, you need to distinguish some cases as in this answer which provides you with the rest of the (cheese) cake (except for the piece stolen by the mouse;-).
If you use tikz-3dplot
, you do not have to guess the curves, and you can adjust the view angles at will.
documentclass[tikz,border=3.14mm]standalone
usepackagetikz-3dplot
begindocument
tdplotsetmaincoords7560
begintikzpicture[tdplot_main_coords]
beginscope[canvas is xy plane at z=0,name prefix=bot-]
draw (0,0) coordinate (O) -- (4,0) coordinate (A) arc (0:60:4) coordinate
(B);
endscope
beginscope[canvas is xy plane at z=2,name prefix=top-]
draw[fill=blue!20] (0,0) coordinate (O) -- (4,0) coordinate (A) arc (0:60:4) coordinate
(B) -- cycle;
endscope
draw foreach X in O,A,B
(bot-X) -- (top-X);
endtikzpicture
enddocument
documentclass[tikz,border=3.14mm]standalone
usepackagetikz-3dplot
begindocument
foreach X in 89,88,...,60,61,62,...,88
tdplotsetmaincoords70+10*sin(6*X)X
pgfmathsetmacroxmin0
pgfmathsetmacroxmax0
pgfmathsetmacroymin0
pgfmathsetmacroymax0
begintikzpicture[tdplot_main_coords]
ifdefinedfigbbrelax
path figbb;
fi
beginscope[canvas is xy plane at z=0,name prefix=bot-]
draw (0,0) coordinate (O) -- (4,0) coordinate (A) arc (0:60:4) coordinate
(B);
endscope
beginscope[canvas is xy plane at z=2,name prefix=top-]
draw[fill=blue!20] (0,0) coordinate (O) -- (4,0) coordinate (A) arc (0:60:4) coordinate
(B) -- cycle;
endscope
draw foreach X in O,A,B (bot-X) -- (top-X);
path let p1=(current bounding box.south west),
p2=(current bounding box.north east)
in pgfextra%
pgfmathsetmacroxminmin(x1,xmin)
pgfmathsetmacroxmaxmax(x2,xmax)
pgfmathsetmacroyminmin(y1,ymin)
pgfmathsetmacroymaxmax(y2,ymax)
xdefxminxmin pt
xdefxmaxxmax pt
xdefyminymin pt
xdefymaxymax pt
;
endtikzpicture
makeatletter
edeffigbb(xmin,ymin) rectangle (xmax,ymax)
immediatewrite@mainauxxdefstringfigbbfigbbrelax
makeatother
enddocument
If you want to allow for arbitrary view angles, you need to distinguish some cases as in this answer which provides you with the rest of the (cheese) cake (except for the piece stolen by the mouse;-).
edited Aug 12 at 3:21
answered Aug 11 at 9:44
user121799user121799
add a comment
|
add a comment
|
One more example: In the drawing, angles are considered in reverse order. For vertical lines, the coordinate is defined, so that only one coordinate now is necessary to determine of height of slice:
documentclass[tikz, margin=3mm]standalone
begindocument
begintikzpicture[
every path/.style = thick, line join=round % style of lines
]
draw[fill=gray!30] (0, 0) -- (-50:4.5) coordinate (a1) arc(-50:-20:4.5) coordinate (a2) -- cycle;
draw (0,0) -- (0,-2) % determine height of slice
-- ++(-50:4.5) coordinate (b1) arc(-50:-20:4.5) coordinate (b2);
draw (a1) -- (b1) (a2) -- (b2);
endtikzpicture
enddocument
add a comment
|
One more example: In the drawing, angles are considered in reverse order. For vertical lines, the coordinate is defined, so that only one coordinate now is necessary to determine of height of slice:
documentclass[tikz, margin=3mm]standalone
begindocument
begintikzpicture[
every path/.style = thick, line join=round % style of lines
]
draw[fill=gray!30] (0, 0) -- (-50:4.5) coordinate (a1) arc(-50:-20:4.5) coordinate (a2) -- cycle;
draw (0,0) -- (0,-2) % determine height of slice
-- ++(-50:4.5) coordinate (b1) arc(-50:-20:4.5) coordinate (b2);
draw (a1) -- (b1) (a2) -- (b2);
endtikzpicture
enddocument
add a comment
|
One more example: In the drawing, angles are considered in reverse order. For vertical lines, the coordinate is defined, so that only one coordinate now is necessary to determine of height of slice:
documentclass[tikz, margin=3mm]standalone
begindocument
begintikzpicture[
every path/.style = thick, line join=round % style of lines
]
draw[fill=gray!30] (0, 0) -- (-50:4.5) coordinate (a1) arc(-50:-20:4.5) coordinate (a2) -- cycle;
draw (0,0) -- (0,-2) % determine height of slice
-- ++(-50:4.5) coordinate (b1) arc(-50:-20:4.5) coordinate (b2);
draw (a1) -- (b1) (a2) -- (b2);
endtikzpicture
enddocument
One more example: In the drawing, angles are considered in reverse order. For vertical lines, the coordinate is defined, so that only one coordinate now is necessary to determine of height of slice:
documentclass[tikz, margin=3mm]standalone
begindocument
begintikzpicture[
every path/.style = thick, line join=round % style of lines
]
draw[fill=gray!30] (0, 0) -- (-50:4.5) coordinate (a1) arc(-50:-20:4.5) coordinate (a2) -- cycle;
draw (0,0) -- (0,-2) % determine height of slice
-- ++(-50:4.5) coordinate (b1) arc(-50:-20:4.5) coordinate (b2);
draw (a1) -- (b1) (a2) -- (b2);
endtikzpicture
enddocument
edited Aug 11 at 21:58
Sveinung
15.5k2 gold badges39 silver badges64 bronze badges
15.5k2 gold badges39 silver badges64 bronze badges
answered Aug 11 at 10:10
ZarkoZarko
152k8 gold badges87 silver badges199 bronze badges
152k8 gold badges87 silver badges199 bronze badges
add a comment
|
add a comment
|
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');
);
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%2f503755%2ftikzpicture-finish-drawing-a-curved-line-for-a-cake-slice%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');
);
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');
);
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');
);
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
1
Hello and welcome. Please remove all unused packages from your code.
– AndréC
Aug 11 at 9:02
Off-topic:
hyperref
package should be last in preamble.– Zarko
Aug 11 at 9:06
@Zarko could you explain why?
– Julian Zucker
Aug 11 at 19:24
@JulianZucker, because
hyperref
for its proper work redefine some other packages internals. If you load those package after it, than their internals overwrite those redefinition and with this nullify necessary changes done byhyperref
. See its documentation.– Zarko
Aug 11 at 19:36
Wonderful, thanks!
– Julian Zucker
Aug 11 at 19:39