Drawing a half-full bottle in TikZ
I want to fill half of the bottle. I tried these kind of commands:
%filldraw[color=black!100, fill=cyan!30, very thick](-3,-2.4) arc (180:230:2.5) .. controls (-2,-5) and (-1.9,-5.2) .. (-1.8,-5.5) ;
But I failed. Here is the bottle:
documentclass[11pt,a4paper,oneside]{article}
usepackage[a4paper,left=3cm,right=2cm,top=2.5cm,bottom=2.5cm]{geometry}
usepackage[utf8x]{inputenc}
usepackage{tikz}
begin{document}
begin{tikzpicture}[xscale=1,yscale=1]
draw[very thick](0,0) arc (0:180:1.5);
draw[very thick] (-3,0) -- (-3,-2.5);
draw[very thick] (0,0) -- (0,-2.5);
draw[color=black!100,very thick](-3,-2.5) arc (180:235:3);
draw[color=black!100,very thick](0,-2.5) arc (0:-55:3);
draw[very thick] (-1.25,-4.95) -- (-1.25,-5.2) -- (-1.7,-5.2) -- (-1.7,-4.95);
end{tikzpicture}
end{document}
What I want:
tikz-pgf draw fill
add a comment |
I want to fill half of the bottle. I tried these kind of commands:
%filldraw[color=black!100, fill=cyan!30, very thick](-3,-2.4) arc (180:230:2.5) .. controls (-2,-5) and (-1.9,-5.2) .. (-1.8,-5.5) ;
But I failed. Here is the bottle:
documentclass[11pt,a4paper,oneside]{article}
usepackage[a4paper,left=3cm,right=2cm,top=2.5cm,bottom=2.5cm]{geometry}
usepackage[utf8x]{inputenc}
usepackage{tikz}
begin{document}
begin{tikzpicture}[xscale=1,yscale=1]
draw[very thick](0,0) arc (0:180:1.5);
draw[very thick] (-3,0) -- (-3,-2.5);
draw[very thick] (0,0) -- (0,-2.5);
draw[color=black!100,very thick](-3,-2.5) arc (180:235:3);
draw[color=black!100,very thick](0,-2.5) arc (0:-55:3);
draw[very thick] (-1.25,-4.95) -- (-1.25,-5.2) -- (-1.7,-5.2) -- (-1.7,-4.95);
end{tikzpicture}
end{document}
What I want:
tikz-pgf draw fill
Simply draw the half bottle starting with the neck on the left side and ending with the neck on the right side.
– AndréC
1 hour ago
add a comment |
I want to fill half of the bottle. I tried these kind of commands:
%filldraw[color=black!100, fill=cyan!30, very thick](-3,-2.4) arc (180:230:2.5) .. controls (-2,-5) and (-1.9,-5.2) .. (-1.8,-5.5) ;
But I failed. Here is the bottle:
documentclass[11pt,a4paper,oneside]{article}
usepackage[a4paper,left=3cm,right=2cm,top=2.5cm,bottom=2.5cm]{geometry}
usepackage[utf8x]{inputenc}
usepackage{tikz}
begin{document}
begin{tikzpicture}[xscale=1,yscale=1]
draw[very thick](0,0) arc (0:180:1.5);
draw[very thick] (-3,0) -- (-3,-2.5);
draw[very thick] (0,0) -- (0,-2.5);
draw[color=black!100,very thick](-3,-2.5) arc (180:235:3);
draw[color=black!100,very thick](0,-2.5) arc (0:-55:3);
draw[very thick] (-1.25,-4.95) -- (-1.25,-5.2) -- (-1.7,-5.2) -- (-1.7,-4.95);
end{tikzpicture}
end{document}
What I want:
tikz-pgf draw fill
I want to fill half of the bottle. I tried these kind of commands:
%filldraw[color=black!100, fill=cyan!30, very thick](-3,-2.4) arc (180:230:2.5) .. controls (-2,-5) and (-1.9,-5.2) .. (-1.8,-5.5) ;
But I failed. Here is the bottle:
documentclass[11pt,a4paper,oneside]{article}
usepackage[a4paper,left=3cm,right=2cm,top=2.5cm,bottom=2.5cm]{geometry}
usepackage[utf8x]{inputenc}
usepackage{tikz}
begin{document}
begin{tikzpicture}[xscale=1,yscale=1]
draw[very thick](0,0) arc (0:180:1.5);
draw[very thick] (-3,0) -- (-3,-2.5);
draw[very thick] (0,0) -- (0,-2.5);
draw[color=black!100,very thick](-3,-2.5) arc (180:235:3);
draw[color=black!100,very thick](0,-2.5) arc (0:-55:3);
draw[very thick] (-1.25,-4.95) -- (-1.25,-5.2) -- (-1.7,-5.2) -- (-1.7,-4.95);
end{tikzpicture}
end{document}
What I want:
tikz-pgf draw fill
tikz-pgf draw fill
edited 1 hour ago
chrisma
906416
906416
asked 2 hours ago
Rageful
496
496
Simply draw the half bottle starting with the neck on the left side and ending with the neck on the right side.
– AndréC
1 hour ago
add a comment |
Simply draw the half bottle starting with the neck on the left side and ending with the neck on the right side.
– AndréC
1 hour ago
Simply draw the half bottle starting with the neck on the left side and ending with the neck on the right side.
– AndréC
1 hour ago
Simply draw the half bottle starting with the neck on the left side and ending with the neck on the right side.
– AndréC
1 hour ago
add a comment |
2 Answers
2
active
oldest
votes
documentclass[border=5pt,tikz]{standalone}
begin{document}
begin{tikzpicture}[xscale=1,yscale=1]
fill[blue!20] (0,-2.5) --+ (0,2.5) arc (0:180:1.5) -- (-3,-2.5) arc (180:235:3) --+ (0,-.25) --+ (.45,-.25) --+ (.45,.015) (0,-2.5) arc (0:-55:3);
fill[white] (0,0) arc(0:180:1.5) --+ (0,-2) -| cycle;
draw[very thick] (0,-2.5) --+ (0,2.5) arc (0:180:1.5) -- (-3,-2.5) arc (180:235:3) --+ (0,-.25) --+ (.45,-.25) --+ (.45,.015) (0,-2.5) arc (0:-55:3);
end{tikzpicture}
end{document}
Output:
EDIT:
A little bit better solution:
documentclass[border=5pt,tikz]{standalone}
begin{document}
begin{tikzpicture}[xscale=1,yscale=1]
clip (0,-2.5) --+ (0,2.5) arc (0:180:1.5) -- (-3,-2.5) arc (180:235:3) --+ (0,-.25) --+ (.45,-.25) --+ (.45,.015) (0,-2.5) arc (0:-55:3);
fill[blue!20] (-3,-5.5) rectangle ++(3,3);
draw[very thick] (0,-2.5) --+ (0,2.5) arc (0:180:1.5) -- (-3,-2.5) arc (180:235:3) --+ (0,-.25) --+ (.45,-.25) --+ (.45,.015) (0,-2.5) arc (0:-55:3);
end{tikzpicture}
end{document}
add a comment |
documentclass[11pt,a4paper,oneside]{article}
usepackage[a4paper,left=3cm,right=2cm,top=2.5cm,bottom=2.5cm]{geometry}
usepackage[utf8x]{inputenc}
usepackage{tikz}
begin{document}
begin{tikzpicture}[xscale=1,yscale=1]
draw[very thick](0,0) arc (0:180:1.5);
draw[very thick] (-3,0) -- (-3,-2.5);
draw[very thick] (0,0) -- (0,-2.5);
draw[color=black!100,very thick](-3,-2.5)coordinate(A) arc (180:235:3);
draw[color=black!100,very thick](0,-2.5) arc (0:-55:3);
draw[very thick] (-1.25,-4.95)coordinate(E) -- (-1.25,-5.2)coordinate(F) -- (-1.7,-5.2)coordinate(G) -- (-1.7,-4.95)coordinate(H);
begin{scope}
shade[right color=orange,left color=orange,opacity=0.35]
(A) -- (A) arc (180:235:3)--(H)--(G)--(F)--(E)--(E) arc (-55:0:3);
end{scope}
end{tikzpicture}
end{document}
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
});
}
});
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%2f468012%2fdrawing-a-half-full-bottle-in-tikz%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
documentclass[border=5pt,tikz]{standalone}
begin{document}
begin{tikzpicture}[xscale=1,yscale=1]
fill[blue!20] (0,-2.5) --+ (0,2.5) arc (0:180:1.5) -- (-3,-2.5) arc (180:235:3) --+ (0,-.25) --+ (.45,-.25) --+ (.45,.015) (0,-2.5) arc (0:-55:3);
fill[white] (0,0) arc(0:180:1.5) --+ (0,-2) -| cycle;
draw[very thick] (0,-2.5) --+ (0,2.5) arc (0:180:1.5) -- (-3,-2.5) arc (180:235:3) --+ (0,-.25) --+ (.45,-.25) --+ (.45,.015) (0,-2.5) arc (0:-55:3);
end{tikzpicture}
end{document}
Output:
EDIT:
A little bit better solution:
documentclass[border=5pt,tikz]{standalone}
begin{document}
begin{tikzpicture}[xscale=1,yscale=1]
clip (0,-2.5) --+ (0,2.5) arc (0:180:1.5) -- (-3,-2.5) arc (180:235:3) --+ (0,-.25) --+ (.45,-.25) --+ (.45,.015) (0,-2.5) arc (0:-55:3);
fill[blue!20] (-3,-5.5) rectangle ++(3,3);
draw[very thick] (0,-2.5) --+ (0,2.5) arc (0:180:1.5) -- (-3,-2.5) arc (180:235:3) --+ (0,-.25) --+ (.45,-.25) --+ (.45,.015) (0,-2.5) arc (0:-55:3);
end{tikzpicture}
end{document}
add a comment |
documentclass[border=5pt,tikz]{standalone}
begin{document}
begin{tikzpicture}[xscale=1,yscale=1]
fill[blue!20] (0,-2.5) --+ (0,2.5) arc (0:180:1.5) -- (-3,-2.5) arc (180:235:3) --+ (0,-.25) --+ (.45,-.25) --+ (.45,.015) (0,-2.5) arc (0:-55:3);
fill[white] (0,0) arc(0:180:1.5) --+ (0,-2) -| cycle;
draw[very thick] (0,-2.5) --+ (0,2.5) arc (0:180:1.5) -- (-3,-2.5) arc (180:235:3) --+ (0,-.25) --+ (.45,-.25) --+ (.45,.015) (0,-2.5) arc (0:-55:3);
end{tikzpicture}
end{document}
Output:
EDIT:
A little bit better solution:
documentclass[border=5pt,tikz]{standalone}
begin{document}
begin{tikzpicture}[xscale=1,yscale=1]
clip (0,-2.5) --+ (0,2.5) arc (0:180:1.5) -- (-3,-2.5) arc (180:235:3) --+ (0,-.25) --+ (.45,-.25) --+ (.45,.015) (0,-2.5) arc (0:-55:3);
fill[blue!20] (-3,-5.5) rectangle ++(3,3);
draw[very thick] (0,-2.5) --+ (0,2.5) arc (0:180:1.5) -- (-3,-2.5) arc (180:235:3) --+ (0,-.25) --+ (.45,-.25) --+ (.45,.015) (0,-2.5) arc (0:-55:3);
end{tikzpicture}
end{document}
add a comment |
documentclass[border=5pt,tikz]{standalone}
begin{document}
begin{tikzpicture}[xscale=1,yscale=1]
fill[blue!20] (0,-2.5) --+ (0,2.5) arc (0:180:1.5) -- (-3,-2.5) arc (180:235:3) --+ (0,-.25) --+ (.45,-.25) --+ (.45,.015) (0,-2.5) arc (0:-55:3);
fill[white] (0,0) arc(0:180:1.5) --+ (0,-2) -| cycle;
draw[very thick] (0,-2.5) --+ (0,2.5) arc (0:180:1.5) -- (-3,-2.5) arc (180:235:3) --+ (0,-.25) --+ (.45,-.25) --+ (.45,.015) (0,-2.5) arc (0:-55:3);
end{tikzpicture}
end{document}
Output:
EDIT:
A little bit better solution:
documentclass[border=5pt,tikz]{standalone}
begin{document}
begin{tikzpicture}[xscale=1,yscale=1]
clip (0,-2.5) --+ (0,2.5) arc (0:180:1.5) -- (-3,-2.5) arc (180:235:3) --+ (0,-.25) --+ (.45,-.25) --+ (.45,.015) (0,-2.5) arc (0:-55:3);
fill[blue!20] (-3,-5.5) rectangle ++(3,3);
draw[very thick] (0,-2.5) --+ (0,2.5) arc (0:180:1.5) -- (-3,-2.5) arc (180:235:3) --+ (0,-.25) --+ (.45,-.25) --+ (.45,.015) (0,-2.5) arc (0:-55:3);
end{tikzpicture}
end{document}
documentclass[border=5pt,tikz]{standalone}
begin{document}
begin{tikzpicture}[xscale=1,yscale=1]
fill[blue!20] (0,-2.5) --+ (0,2.5) arc (0:180:1.5) -- (-3,-2.5) arc (180:235:3) --+ (0,-.25) --+ (.45,-.25) --+ (.45,.015) (0,-2.5) arc (0:-55:3);
fill[white] (0,0) arc(0:180:1.5) --+ (0,-2) -| cycle;
draw[very thick] (0,-2.5) --+ (0,2.5) arc (0:180:1.5) -- (-3,-2.5) arc (180:235:3) --+ (0,-.25) --+ (.45,-.25) --+ (.45,.015) (0,-2.5) arc (0:-55:3);
end{tikzpicture}
end{document}
Output:
EDIT:
A little bit better solution:
documentclass[border=5pt,tikz]{standalone}
begin{document}
begin{tikzpicture}[xscale=1,yscale=1]
clip (0,-2.5) --+ (0,2.5) arc (0:180:1.5) -- (-3,-2.5) arc (180:235:3) --+ (0,-.25) --+ (.45,-.25) --+ (.45,.015) (0,-2.5) arc (0:-55:3);
fill[blue!20] (-3,-5.5) rectangle ++(3,3);
draw[very thick] (0,-2.5) --+ (0,2.5) arc (0:180:1.5) -- (-3,-2.5) arc (180:235:3) --+ (0,-.25) --+ (.45,-.25) --+ (.45,.015) (0,-2.5) arc (0:-55:3);
end{tikzpicture}
end{document}
edited 40 secs ago
answered 1 hour ago
current_user
3,2001436
3,2001436
add a comment |
add a comment |
documentclass[11pt,a4paper,oneside]{article}
usepackage[a4paper,left=3cm,right=2cm,top=2.5cm,bottom=2.5cm]{geometry}
usepackage[utf8x]{inputenc}
usepackage{tikz}
begin{document}
begin{tikzpicture}[xscale=1,yscale=1]
draw[very thick](0,0) arc (0:180:1.5);
draw[very thick] (-3,0) -- (-3,-2.5);
draw[very thick] (0,0) -- (0,-2.5);
draw[color=black!100,very thick](-3,-2.5)coordinate(A) arc (180:235:3);
draw[color=black!100,very thick](0,-2.5) arc (0:-55:3);
draw[very thick] (-1.25,-4.95)coordinate(E) -- (-1.25,-5.2)coordinate(F) -- (-1.7,-5.2)coordinate(G) -- (-1.7,-4.95)coordinate(H);
begin{scope}
shade[right color=orange,left color=orange,opacity=0.35]
(A) -- (A) arc (180:235:3)--(H)--(G)--(F)--(E)--(E) arc (-55:0:3);
end{scope}
end{tikzpicture}
end{document}
add a comment |
documentclass[11pt,a4paper,oneside]{article}
usepackage[a4paper,left=3cm,right=2cm,top=2.5cm,bottom=2.5cm]{geometry}
usepackage[utf8x]{inputenc}
usepackage{tikz}
begin{document}
begin{tikzpicture}[xscale=1,yscale=1]
draw[very thick](0,0) arc (0:180:1.5);
draw[very thick] (-3,0) -- (-3,-2.5);
draw[very thick] (0,0) -- (0,-2.5);
draw[color=black!100,very thick](-3,-2.5)coordinate(A) arc (180:235:3);
draw[color=black!100,very thick](0,-2.5) arc (0:-55:3);
draw[very thick] (-1.25,-4.95)coordinate(E) -- (-1.25,-5.2)coordinate(F) -- (-1.7,-5.2)coordinate(G) -- (-1.7,-4.95)coordinate(H);
begin{scope}
shade[right color=orange,left color=orange,opacity=0.35]
(A) -- (A) arc (180:235:3)--(H)--(G)--(F)--(E)--(E) arc (-55:0:3);
end{scope}
end{tikzpicture}
end{document}
add a comment |
documentclass[11pt,a4paper,oneside]{article}
usepackage[a4paper,left=3cm,right=2cm,top=2.5cm,bottom=2.5cm]{geometry}
usepackage[utf8x]{inputenc}
usepackage{tikz}
begin{document}
begin{tikzpicture}[xscale=1,yscale=1]
draw[very thick](0,0) arc (0:180:1.5);
draw[very thick] (-3,0) -- (-3,-2.5);
draw[very thick] (0,0) -- (0,-2.5);
draw[color=black!100,very thick](-3,-2.5)coordinate(A) arc (180:235:3);
draw[color=black!100,very thick](0,-2.5) arc (0:-55:3);
draw[very thick] (-1.25,-4.95)coordinate(E) -- (-1.25,-5.2)coordinate(F) -- (-1.7,-5.2)coordinate(G) -- (-1.7,-4.95)coordinate(H);
begin{scope}
shade[right color=orange,left color=orange,opacity=0.35]
(A) -- (A) arc (180:235:3)--(H)--(G)--(F)--(E)--(E) arc (-55:0:3);
end{scope}
end{tikzpicture}
end{document}
documentclass[11pt,a4paper,oneside]{article}
usepackage[a4paper,left=3cm,right=2cm,top=2.5cm,bottom=2.5cm]{geometry}
usepackage[utf8x]{inputenc}
usepackage{tikz}
begin{document}
begin{tikzpicture}[xscale=1,yscale=1]
draw[very thick](0,0) arc (0:180:1.5);
draw[very thick] (-3,0) -- (-3,-2.5);
draw[very thick] (0,0) -- (0,-2.5);
draw[color=black!100,very thick](-3,-2.5)coordinate(A) arc (180:235:3);
draw[color=black!100,very thick](0,-2.5) arc (0:-55:3);
draw[very thick] (-1.25,-4.95)coordinate(E) -- (-1.25,-5.2)coordinate(F) -- (-1.7,-5.2)coordinate(G) -- (-1.7,-4.95)coordinate(H);
begin{scope}
shade[right color=orange,left color=orange,opacity=0.35]
(A) -- (A) arc (180:235:3)--(H)--(G)--(F)--(E)--(E) arc (-55:0:3);
end{scope}
end{tikzpicture}
end{document}
edited 15 mins ago
answered 1 hour ago
ferahfeza
5,25411830
5,25411830
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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%2f468012%2fdrawing-a-half-full-bottle-in-tikz%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
Simply draw the half bottle starting with the neck on the left side and ending with the neck on the right side.
– AndréC
1 hour ago