3D Volume in TIKZDrawing Loops in TikZMaking a 3D colored pyramid in tikzmultiple relative positioning in tikzRotating rectangle node in tikz without getting the right angleThree dimensional Regression Plan with ResidualsHelp with drawing tikz diagrams of worldsheet topologiestikz: fancy polyhedron in three dimensional spaceLatex Tikz - Process flow imageDraw curve in the plane by using tikzDrawing a DNA/SNP genome double helix in TikZ
How can I roleplay a follower-type character when I as a player have a leader-type personality?
Has a commercial or military jet bi-plane ever been manufactured?
I need a disease
Something that can be activated/enabled
Where can I go to avoid planes overhead?
How do LIGO and VIRGO know that a gravitational wave has its origin in a neutron star or a black hole?
Is there a word that describe the non-justified use of a more complex word?
Word for Food that's Gone 'Bad', but is Still Edible?
Where are the "shires" in the UK?
What was Bran's plan to kill the Night King?
US born but as a child of foreign diplomat
Can there be a single technologically advanced nation, in a continent full of non-technologically advanced nations?
A factorization game
Why do people keep telling me that I am a bad photographer?
ZSPL language, anyone heard of it?
Decoupling cap routing on a 4 layer PCB
Copy previous line to current line from text file
Nominativ or Akkusativ
Appropriate certificate to ask for a fibre installation (ANSI/TIA-568.3-D?)
Floor of Riemann zeta function
How to write a 12-bar blues melody
How can internet speed be 10 times slower without a router than when using a router?
IP addresses from public IP block in my LAN
Do I add modifiers to the Charisma check roll of 15 granted by the Glibness spell?
3D Volume in TIKZ
Drawing Loops in TikZMaking a 3D colored pyramid in tikzmultiple relative positioning in tikzRotating rectangle node in tikz without getting the right angleThree dimensional Regression Plan with ResidualsHelp with drawing tikz diagrams of worldsheet topologiestikz: fancy polyhedron in three dimensional spaceLatex Tikz - Process flow imageDraw curve in the plane by using tikzDrawing a DNA/SNP genome double helix in TikZ
I need to make the square base volume below any function in a three-dimensional space.
It can be any function.
I need help getting this job started.
The image is bad, but that's the idea.
tikz-pgf
New contributor
add a comment |
I need to make the square base volume below any function in a three-dimensional space.
It can be any function.
I need help getting this job started.
The image is bad, but that's the idea.
tikz-pgf
New contributor
3
Welcome to TeX.SE! What have you tried so far?
– Kurt
3 hours ago
add a comment |
I need to make the square base volume below any function in a three-dimensional space.
It can be any function.
I need help getting this job started.
The image is bad, but that's the idea.
tikz-pgf
New contributor
I need to make the square base volume below any function in a three-dimensional space.
It can be any function.
I need help getting this job started.
The image is bad, but that's the idea.
tikz-pgf
tikz-pgf
New contributor
New contributor
New contributor
asked 4 hours ago
Ícaro ViterbreÍcaro Viterbre
61
61
New contributor
New contributor
3
Welcome to TeX.SE! What have you tried so far?
– Kurt
3 hours ago
add a comment |
3
Welcome to TeX.SE! What have you tried so far?
– Kurt
3 hours ago
3
3
Welcome to TeX.SE! What have you tried so far?
– Kurt
3 hours ago
Welcome to TeX.SE! What have you tried so far?
– Kurt
3 hours ago
add a comment |
2 Answers
2
active
oldest
votes
The tikz-3dplot
package allows you to draw things in 3d and perform orthographic projections.
documentclass[tikz,border=3.14mm]standalone
usepackagetikz-3dplot
begindocument
tdplotsetmaincoords60110
begintikzpicture[tdplot_main_coords,>=stealth,declare function=%
pfft(x)=pi+0.3*sin(deg(x));]
draw[->] (0,0,0) coordinate (O) -- (5,0,0) coordinate(X) node[pos=1.1]$x$;
draw[->] (O) -- (0,5,0) node[pos=1.1]$y$;
draw[->] (O) -- (0,0,5) node[pos=1.1]$z$;
draw[thick] plot[variable=x,domain=0.8*pi:1.1*pi,smooth] (2.2,x,pfft(2*x))
coordinate (T1)--
plot[variable=x,domain=1.1*pi:0.8*pi,smooth] (0.8,x,pfft(2*x)) coordinate
(T3)-- cycle;
draw (2.2,0.8*pi,0) coordinate (B4)-- (2.2,1.1*pi,0) coordinate (B1)
-- (0.8,1.1*pi,0) coordinate (B2) -- (0.8,0.8*pi,0) coordinate (B3) -- cycle;
path (2.2,0.8*pi,pfft(2*0.8*pi)) coordinate (T4)
(0.8,1.1*pi,pfft(2*1.1*pi)) coordinate (T2);
foreach X in 1,...,4
draw (BX) -- (TX);
path[opacity=0.3,left color=blue,right color=blue,middle color=blue!20,shading
angle=72]
plot[variable=x,domain=0:1.1*pi,smooth] (3,x,pfft(2*x)) --
plot[variable=x,domain=1.1*pi:0,smooth] (0,x,pfft(2*x)) -- cycle;
path[opacity=0.3,left color=blue,right color=blue,middle color=blue!20,shading
angle=72]
plot[variable=x,domain=1.1*pi:2.2*pi,smooth] (3,x,pfft(2*x)) --
plot[variable=x,domain=2.2*pi:1.1*pi,smooth] (0,x,pfft(2*x)) -- cycle;
draw plot[variable=x,domain=0:2.2*pi,smooth] (3,x,pfft(2*x)) --
plot[variable=x,domain=2.2*pi:0,smooth] (0,x,pfft(2*x)) -- cycle;
endtikzpicture
enddocument
You may want to store the parameters in pgf keys.
documentclass[tikz,border=3.14mm]standalone
usepackagetikz-3dplot
begindocument
tdplotsetmaincoords60110
foreach X in 0,...,35
pgfmathsetmacroObjymax1.6*pi+0.5*sin(10*X)*pi
begintikzpicture[tdplot_main_coords,>=stealth,declare function=%
pfft(x)=2+0.3*sin(deg(x));,/tikz/3D surface/.cd,
ymin/.initial=0,ymax/.initial=2.2*pi,xmin/.initial=1,xmax/.initial=4,
/tikz/3D object/.cd,
ymin/.initial=0.8*pi,ymax/.initial=Objymax,xmin/.initial=1.8,xmax/.initial=3.2]
draw[->] (0,0,0) coordinate (O) -- (5,0,0) coordinate(X) node[pos=1.1]$x$;
draw[->] (O) -- (0,5,0) node[pos=1.1]$y$;
draw[->] (O) -- (0,0,5) node[pos=1.1]$z$;
draw[thick] plot[variable=x,domain=pgfkeysvalueof/tikz/3D object/ymin:pgfkeysvalueof/tikz/3D object/ymax,smooth]
(pgfkeysvalueof/tikz/3D object/xmax,x,pfft(2*x))
coordinate (T1)--
plot[variable=x,domain=pgfkeysvalueof/tikz/3D object/ymax:pgfkeysvalueof/tikz/3D object/ymin,smooth]
(pgfkeysvalueof/tikz/3D object/xmin,x,pfft(2*x)) coordinate
(T3)-- cycle;
draw (pgfkeysvalueof/tikz/3D object/xmax,pgfkeysvalueof/tikz/3D object/ymin,0) coordinate (B4)--
(pgfkeysvalueof/tikz/3D object/xmax,pgfkeysvalueof/tikz/3D
object/ymax,0) coordinate (B1)
-- (pgfkeysvalueof/tikz/3D object/xmin,pgfkeysvalueof/tikz/3D object/ymax,0) coordinate (B2) -- (pgfkeysvalueof/tikz/3D object/xmin,pgfkeysvalueof/tikz/3D object/ymin,0) coordinate (B3) -- cycle;
path (pgfkeysvalueof/tikz/3D object/xmax,pgfkeysvalueof/tikz/3D object/ymin,pfft(2*pgfkeysvalueof/tikz/3D object/ymin)) coordinate (T4)
(pgfkeysvalueof/tikz/3D object/xmin,pgfkeysvalueof/tikz/3D
object/ymax,pfft(2*pgfkeysvalueof/tikz/3D object/ymax)) coordinate (T2);
foreach X in 1,...,4
draw (BX) -- (TX);
path[opacity=0.3,left color=blue,right color=blue,middle color=blue!20,shading
angle=72]
plot[variable=x,domain=pgfkeysvalueof/tikz/3D surface/ymin:(pgfkeysvalueof/tikz/3D
surface/ymax+pgfkeysvalueof/tikz/3D surface/ymin)/2,smooth]
(pgfkeysvalueof/tikz/3D surface/xmax,x,pfft(2*x)) --
plot[variable=x,domain=(pgfkeysvalueof/tikz/3D
surface/ymax+pgfkeysvalueof/tikz/3D surface/ymin)/2:pgfkeysvalueof/tikz/3D surface/ymin,smooth] (pgfkeysvalueof/tikz/3D surface/xmin,x,pfft(2*x)) -- cycle;
path[opacity=0.3,left color=blue,right color=blue,middle color=blue!20,shading
angle=72]
plot[variable=x,domain=(pgfkeysvalueof/tikz/3D
surface/ymax+pgfkeysvalueof/tikz/3D surface/ymin)/2:pgfkeysvalueof/tikz/3D surface/ymax,smooth]
(pgfkeysvalueof/tikz/3D surface/xmax,x,pfft(2*x)) --
plot[variable=x,domain=pgfkeysvalueof/tikz/3D surface/ymax:(pgfkeysvalueof/tikz/3D
surface/ymax+pgfkeysvalueof/tikz/3D surface/ymin)/2,smooth] (pgfkeysvalueof/tikz/3D surface/xmin,x,pfft(2*x)) -- cycle;
draw plot[variable=x,domain=pgfkeysvalueof/tikz/3D surface/ymin:pgfkeysvalueof/tikz/3D surface/ymax,smooth]
(pgfkeysvalueof/tikz/3D surface/xmax,x,pfft(2*x)) --
plot[variable=x,domain=pgfkeysvalueof/tikz/3D surface/ymax:pgfkeysvalueof/tikz/3D surface/ymin,smooth]
(pgfkeysvalueof/tikz/3D surface/xmin,x,pfft(2*x)) -- cycle;
endtikzpicture
enddocument
add a comment |
To help you get started:
documentclassarticle
usepackagetikz
begindocument
begintikzpicture[x=(210:1cm),y=(0:1cm),z=(90:1cm)]
draw (0,0,0) -- (3,0,0) -- (3,3,0)--(0,3,0)--cycle;
draw (3,0,0) -- (3,0,4) .. controls (3,1,3.5) and (3,2,3) .. (3,3,3) -- (3,3,0);
draw (3,3,3) .. controls (2,3,3) and (1,3,5) .. (0,3,5)--(0,3,0);
draw (0,3,5) .. controls (0,2,4) and (0,1,4) .. (0,0,4)--(0,0,0);
draw (0,0,4) -- (3,0,4);
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/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
);
);
Ícaro Viterbre 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');
);
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%2f488865%2f3d-volume-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
The tikz-3dplot
package allows you to draw things in 3d and perform orthographic projections.
documentclass[tikz,border=3.14mm]standalone
usepackagetikz-3dplot
begindocument
tdplotsetmaincoords60110
begintikzpicture[tdplot_main_coords,>=stealth,declare function=%
pfft(x)=pi+0.3*sin(deg(x));]
draw[->] (0,0,0) coordinate (O) -- (5,0,0) coordinate(X) node[pos=1.1]$x$;
draw[->] (O) -- (0,5,0) node[pos=1.1]$y$;
draw[->] (O) -- (0,0,5) node[pos=1.1]$z$;
draw[thick] plot[variable=x,domain=0.8*pi:1.1*pi,smooth] (2.2,x,pfft(2*x))
coordinate (T1)--
plot[variable=x,domain=1.1*pi:0.8*pi,smooth] (0.8,x,pfft(2*x)) coordinate
(T3)-- cycle;
draw (2.2,0.8*pi,0) coordinate (B4)-- (2.2,1.1*pi,0) coordinate (B1)
-- (0.8,1.1*pi,0) coordinate (B2) -- (0.8,0.8*pi,0) coordinate (B3) -- cycle;
path (2.2,0.8*pi,pfft(2*0.8*pi)) coordinate (T4)
(0.8,1.1*pi,pfft(2*1.1*pi)) coordinate (T2);
foreach X in 1,...,4
draw (BX) -- (TX);
path[opacity=0.3,left color=blue,right color=blue,middle color=blue!20,shading
angle=72]
plot[variable=x,domain=0:1.1*pi,smooth] (3,x,pfft(2*x)) --
plot[variable=x,domain=1.1*pi:0,smooth] (0,x,pfft(2*x)) -- cycle;
path[opacity=0.3,left color=blue,right color=blue,middle color=blue!20,shading
angle=72]
plot[variable=x,domain=1.1*pi:2.2*pi,smooth] (3,x,pfft(2*x)) --
plot[variable=x,domain=2.2*pi:1.1*pi,smooth] (0,x,pfft(2*x)) -- cycle;
draw plot[variable=x,domain=0:2.2*pi,smooth] (3,x,pfft(2*x)) --
plot[variable=x,domain=2.2*pi:0,smooth] (0,x,pfft(2*x)) -- cycle;
endtikzpicture
enddocument
You may want to store the parameters in pgf keys.
documentclass[tikz,border=3.14mm]standalone
usepackagetikz-3dplot
begindocument
tdplotsetmaincoords60110
foreach X in 0,...,35
pgfmathsetmacroObjymax1.6*pi+0.5*sin(10*X)*pi
begintikzpicture[tdplot_main_coords,>=stealth,declare function=%
pfft(x)=2+0.3*sin(deg(x));,/tikz/3D surface/.cd,
ymin/.initial=0,ymax/.initial=2.2*pi,xmin/.initial=1,xmax/.initial=4,
/tikz/3D object/.cd,
ymin/.initial=0.8*pi,ymax/.initial=Objymax,xmin/.initial=1.8,xmax/.initial=3.2]
draw[->] (0,0,0) coordinate (O) -- (5,0,0) coordinate(X) node[pos=1.1]$x$;
draw[->] (O) -- (0,5,0) node[pos=1.1]$y$;
draw[->] (O) -- (0,0,5) node[pos=1.1]$z$;
draw[thick] plot[variable=x,domain=pgfkeysvalueof/tikz/3D object/ymin:pgfkeysvalueof/tikz/3D object/ymax,smooth]
(pgfkeysvalueof/tikz/3D object/xmax,x,pfft(2*x))
coordinate (T1)--
plot[variable=x,domain=pgfkeysvalueof/tikz/3D object/ymax:pgfkeysvalueof/tikz/3D object/ymin,smooth]
(pgfkeysvalueof/tikz/3D object/xmin,x,pfft(2*x)) coordinate
(T3)-- cycle;
draw (pgfkeysvalueof/tikz/3D object/xmax,pgfkeysvalueof/tikz/3D object/ymin,0) coordinate (B4)--
(pgfkeysvalueof/tikz/3D object/xmax,pgfkeysvalueof/tikz/3D
object/ymax,0) coordinate (B1)
-- (pgfkeysvalueof/tikz/3D object/xmin,pgfkeysvalueof/tikz/3D object/ymax,0) coordinate (B2) -- (pgfkeysvalueof/tikz/3D object/xmin,pgfkeysvalueof/tikz/3D object/ymin,0) coordinate (B3) -- cycle;
path (pgfkeysvalueof/tikz/3D object/xmax,pgfkeysvalueof/tikz/3D object/ymin,pfft(2*pgfkeysvalueof/tikz/3D object/ymin)) coordinate (T4)
(pgfkeysvalueof/tikz/3D object/xmin,pgfkeysvalueof/tikz/3D
object/ymax,pfft(2*pgfkeysvalueof/tikz/3D object/ymax)) coordinate (T2);
foreach X in 1,...,4
draw (BX) -- (TX);
path[opacity=0.3,left color=blue,right color=blue,middle color=blue!20,shading
angle=72]
plot[variable=x,domain=pgfkeysvalueof/tikz/3D surface/ymin:(pgfkeysvalueof/tikz/3D
surface/ymax+pgfkeysvalueof/tikz/3D surface/ymin)/2,smooth]
(pgfkeysvalueof/tikz/3D surface/xmax,x,pfft(2*x)) --
plot[variable=x,domain=(pgfkeysvalueof/tikz/3D
surface/ymax+pgfkeysvalueof/tikz/3D surface/ymin)/2:pgfkeysvalueof/tikz/3D surface/ymin,smooth] (pgfkeysvalueof/tikz/3D surface/xmin,x,pfft(2*x)) -- cycle;
path[opacity=0.3,left color=blue,right color=blue,middle color=blue!20,shading
angle=72]
plot[variable=x,domain=(pgfkeysvalueof/tikz/3D
surface/ymax+pgfkeysvalueof/tikz/3D surface/ymin)/2:pgfkeysvalueof/tikz/3D surface/ymax,smooth]
(pgfkeysvalueof/tikz/3D surface/xmax,x,pfft(2*x)) --
plot[variable=x,domain=pgfkeysvalueof/tikz/3D surface/ymax:(pgfkeysvalueof/tikz/3D
surface/ymax+pgfkeysvalueof/tikz/3D surface/ymin)/2,smooth] (pgfkeysvalueof/tikz/3D surface/xmin,x,pfft(2*x)) -- cycle;
draw plot[variable=x,domain=pgfkeysvalueof/tikz/3D surface/ymin:pgfkeysvalueof/tikz/3D surface/ymax,smooth]
(pgfkeysvalueof/tikz/3D surface/xmax,x,pfft(2*x)) --
plot[variable=x,domain=pgfkeysvalueof/tikz/3D surface/ymax:pgfkeysvalueof/tikz/3D surface/ymin,smooth]
(pgfkeysvalueof/tikz/3D surface/xmin,x,pfft(2*x)) -- cycle;
endtikzpicture
enddocument
add a comment |
The tikz-3dplot
package allows you to draw things in 3d and perform orthographic projections.
documentclass[tikz,border=3.14mm]standalone
usepackagetikz-3dplot
begindocument
tdplotsetmaincoords60110
begintikzpicture[tdplot_main_coords,>=stealth,declare function=%
pfft(x)=pi+0.3*sin(deg(x));]
draw[->] (0,0,0) coordinate (O) -- (5,0,0) coordinate(X) node[pos=1.1]$x$;
draw[->] (O) -- (0,5,0) node[pos=1.1]$y$;
draw[->] (O) -- (0,0,5) node[pos=1.1]$z$;
draw[thick] plot[variable=x,domain=0.8*pi:1.1*pi,smooth] (2.2,x,pfft(2*x))
coordinate (T1)--
plot[variable=x,domain=1.1*pi:0.8*pi,smooth] (0.8,x,pfft(2*x)) coordinate
(T3)-- cycle;
draw (2.2,0.8*pi,0) coordinate (B4)-- (2.2,1.1*pi,0) coordinate (B1)
-- (0.8,1.1*pi,0) coordinate (B2) -- (0.8,0.8*pi,0) coordinate (B3) -- cycle;
path (2.2,0.8*pi,pfft(2*0.8*pi)) coordinate (T4)
(0.8,1.1*pi,pfft(2*1.1*pi)) coordinate (T2);
foreach X in 1,...,4
draw (BX) -- (TX);
path[opacity=0.3,left color=blue,right color=blue,middle color=blue!20,shading
angle=72]
plot[variable=x,domain=0:1.1*pi,smooth] (3,x,pfft(2*x)) --
plot[variable=x,domain=1.1*pi:0,smooth] (0,x,pfft(2*x)) -- cycle;
path[opacity=0.3,left color=blue,right color=blue,middle color=blue!20,shading
angle=72]
plot[variable=x,domain=1.1*pi:2.2*pi,smooth] (3,x,pfft(2*x)) --
plot[variable=x,domain=2.2*pi:1.1*pi,smooth] (0,x,pfft(2*x)) -- cycle;
draw plot[variable=x,domain=0:2.2*pi,smooth] (3,x,pfft(2*x)) --
plot[variable=x,domain=2.2*pi:0,smooth] (0,x,pfft(2*x)) -- cycle;
endtikzpicture
enddocument
You may want to store the parameters in pgf keys.
documentclass[tikz,border=3.14mm]standalone
usepackagetikz-3dplot
begindocument
tdplotsetmaincoords60110
foreach X in 0,...,35
pgfmathsetmacroObjymax1.6*pi+0.5*sin(10*X)*pi
begintikzpicture[tdplot_main_coords,>=stealth,declare function=%
pfft(x)=2+0.3*sin(deg(x));,/tikz/3D surface/.cd,
ymin/.initial=0,ymax/.initial=2.2*pi,xmin/.initial=1,xmax/.initial=4,
/tikz/3D object/.cd,
ymin/.initial=0.8*pi,ymax/.initial=Objymax,xmin/.initial=1.8,xmax/.initial=3.2]
draw[->] (0,0,0) coordinate (O) -- (5,0,0) coordinate(X) node[pos=1.1]$x$;
draw[->] (O) -- (0,5,0) node[pos=1.1]$y$;
draw[->] (O) -- (0,0,5) node[pos=1.1]$z$;
draw[thick] plot[variable=x,domain=pgfkeysvalueof/tikz/3D object/ymin:pgfkeysvalueof/tikz/3D object/ymax,smooth]
(pgfkeysvalueof/tikz/3D object/xmax,x,pfft(2*x))
coordinate (T1)--
plot[variable=x,domain=pgfkeysvalueof/tikz/3D object/ymax:pgfkeysvalueof/tikz/3D object/ymin,smooth]
(pgfkeysvalueof/tikz/3D object/xmin,x,pfft(2*x)) coordinate
(T3)-- cycle;
draw (pgfkeysvalueof/tikz/3D object/xmax,pgfkeysvalueof/tikz/3D object/ymin,0) coordinate (B4)--
(pgfkeysvalueof/tikz/3D object/xmax,pgfkeysvalueof/tikz/3D
object/ymax,0) coordinate (B1)
-- (pgfkeysvalueof/tikz/3D object/xmin,pgfkeysvalueof/tikz/3D object/ymax,0) coordinate (B2) -- (pgfkeysvalueof/tikz/3D object/xmin,pgfkeysvalueof/tikz/3D object/ymin,0) coordinate (B3) -- cycle;
path (pgfkeysvalueof/tikz/3D object/xmax,pgfkeysvalueof/tikz/3D object/ymin,pfft(2*pgfkeysvalueof/tikz/3D object/ymin)) coordinate (T4)
(pgfkeysvalueof/tikz/3D object/xmin,pgfkeysvalueof/tikz/3D
object/ymax,pfft(2*pgfkeysvalueof/tikz/3D object/ymax)) coordinate (T2);
foreach X in 1,...,4
draw (BX) -- (TX);
path[opacity=0.3,left color=blue,right color=blue,middle color=blue!20,shading
angle=72]
plot[variable=x,domain=pgfkeysvalueof/tikz/3D surface/ymin:(pgfkeysvalueof/tikz/3D
surface/ymax+pgfkeysvalueof/tikz/3D surface/ymin)/2,smooth]
(pgfkeysvalueof/tikz/3D surface/xmax,x,pfft(2*x)) --
plot[variable=x,domain=(pgfkeysvalueof/tikz/3D
surface/ymax+pgfkeysvalueof/tikz/3D surface/ymin)/2:pgfkeysvalueof/tikz/3D surface/ymin,smooth] (pgfkeysvalueof/tikz/3D surface/xmin,x,pfft(2*x)) -- cycle;
path[opacity=0.3,left color=blue,right color=blue,middle color=blue!20,shading
angle=72]
plot[variable=x,domain=(pgfkeysvalueof/tikz/3D
surface/ymax+pgfkeysvalueof/tikz/3D surface/ymin)/2:pgfkeysvalueof/tikz/3D surface/ymax,smooth]
(pgfkeysvalueof/tikz/3D surface/xmax,x,pfft(2*x)) --
plot[variable=x,domain=pgfkeysvalueof/tikz/3D surface/ymax:(pgfkeysvalueof/tikz/3D
surface/ymax+pgfkeysvalueof/tikz/3D surface/ymin)/2,smooth] (pgfkeysvalueof/tikz/3D surface/xmin,x,pfft(2*x)) -- cycle;
draw plot[variable=x,domain=pgfkeysvalueof/tikz/3D surface/ymin:pgfkeysvalueof/tikz/3D surface/ymax,smooth]
(pgfkeysvalueof/tikz/3D surface/xmax,x,pfft(2*x)) --
plot[variable=x,domain=pgfkeysvalueof/tikz/3D surface/ymax:pgfkeysvalueof/tikz/3D surface/ymin,smooth]
(pgfkeysvalueof/tikz/3D surface/xmin,x,pfft(2*x)) -- cycle;
endtikzpicture
enddocument
add a comment |
The tikz-3dplot
package allows you to draw things in 3d and perform orthographic projections.
documentclass[tikz,border=3.14mm]standalone
usepackagetikz-3dplot
begindocument
tdplotsetmaincoords60110
begintikzpicture[tdplot_main_coords,>=stealth,declare function=%
pfft(x)=pi+0.3*sin(deg(x));]
draw[->] (0,0,0) coordinate (O) -- (5,0,0) coordinate(X) node[pos=1.1]$x$;
draw[->] (O) -- (0,5,0) node[pos=1.1]$y$;
draw[->] (O) -- (0,0,5) node[pos=1.1]$z$;
draw[thick] plot[variable=x,domain=0.8*pi:1.1*pi,smooth] (2.2,x,pfft(2*x))
coordinate (T1)--
plot[variable=x,domain=1.1*pi:0.8*pi,smooth] (0.8,x,pfft(2*x)) coordinate
(T3)-- cycle;
draw (2.2,0.8*pi,0) coordinate (B4)-- (2.2,1.1*pi,0) coordinate (B1)
-- (0.8,1.1*pi,0) coordinate (B2) -- (0.8,0.8*pi,0) coordinate (B3) -- cycle;
path (2.2,0.8*pi,pfft(2*0.8*pi)) coordinate (T4)
(0.8,1.1*pi,pfft(2*1.1*pi)) coordinate (T2);
foreach X in 1,...,4
draw (BX) -- (TX);
path[opacity=0.3,left color=blue,right color=blue,middle color=blue!20,shading
angle=72]
plot[variable=x,domain=0:1.1*pi,smooth] (3,x,pfft(2*x)) --
plot[variable=x,domain=1.1*pi:0,smooth] (0,x,pfft(2*x)) -- cycle;
path[opacity=0.3,left color=blue,right color=blue,middle color=blue!20,shading
angle=72]
plot[variable=x,domain=1.1*pi:2.2*pi,smooth] (3,x,pfft(2*x)) --
plot[variable=x,domain=2.2*pi:1.1*pi,smooth] (0,x,pfft(2*x)) -- cycle;
draw plot[variable=x,domain=0:2.2*pi,smooth] (3,x,pfft(2*x)) --
plot[variable=x,domain=2.2*pi:0,smooth] (0,x,pfft(2*x)) -- cycle;
endtikzpicture
enddocument
You may want to store the parameters in pgf keys.
documentclass[tikz,border=3.14mm]standalone
usepackagetikz-3dplot
begindocument
tdplotsetmaincoords60110
foreach X in 0,...,35
pgfmathsetmacroObjymax1.6*pi+0.5*sin(10*X)*pi
begintikzpicture[tdplot_main_coords,>=stealth,declare function=%
pfft(x)=2+0.3*sin(deg(x));,/tikz/3D surface/.cd,
ymin/.initial=0,ymax/.initial=2.2*pi,xmin/.initial=1,xmax/.initial=4,
/tikz/3D object/.cd,
ymin/.initial=0.8*pi,ymax/.initial=Objymax,xmin/.initial=1.8,xmax/.initial=3.2]
draw[->] (0,0,0) coordinate (O) -- (5,0,0) coordinate(X) node[pos=1.1]$x$;
draw[->] (O) -- (0,5,0) node[pos=1.1]$y$;
draw[->] (O) -- (0,0,5) node[pos=1.1]$z$;
draw[thick] plot[variable=x,domain=pgfkeysvalueof/tikz/3D object/ymin:pgfkeysvalueof/tikz/3D object/ymax,smooth]
(pgfkeysvalueof/tikz/3D object/xmax,x,pfft(2*x))
coordinate (T1)--
plot[variable=x,domain=pgfkeysvalueof/tikz/3D object/ymax:pgfkeysvalueof/tikz/3D object/ymin,smooth]
(pgfkeysvalueof/tikz/3D object/xmin,x,pfft(2*x)) coordinate
(T3)-- cycle;
draw (pgfkeysvalueof/tikz/3D object/xmax,pgfkeysvalueof/tikz/3D object/ymin,0) coordinate (B4)--
(pgfkeysvalueof/tikz/3D object/xmax,pgfkeysvalueof/tikz/3D
object/ymax,0) coordinate (B1)
-- (pgfkeysvalueof/tikz/3D object/xmin,pgfkeysvalueof/tikz/3D object/ymax,0) coordinate (B2) -- (pgfkeysvalueof/tikz/3D object/xmin,pgfkeysvalueof/tikz/3D object/ymin,0) coordinate (B3) -- cycle;
path (pgfkeysvalueof/tikz/3D object/xmax,pgfkeysvalueof/tikz/3D object/ymin,pfft(2*pgfkeysvalueof/tikz/3D object/ymin)) coordinate (T4)
(pgfkeysvalueof/tikz/3D object/xmin,pgfkeysvalueof/tikz/3D
object/ymax,pfft(2*pgfkeysvalueof/tikz/3D object/ymax)) coordinate (T2);
foreach X in 1,...,4
draw (BX) -- (TX);
path[opacity=0.3,left color=blue,right color=blue,middle color=blue!20,shading
angle=72]
plot[variable=x,domain=pgfkeysvalueof/tikz/3D surface/ymin:(pgfkeysvalueof/tikz/3D
surface/ymax+pgfkeysvalueof/tikz/3D surface/ymin)/2,smooth]
(pgfkeysvalueof/tikz/3D surface/xmax,x,pfft(2*x)) --
plot[variable=x,domain=(pgfkeysvalueof/tikz/3D
surface/ymax+pgfkeysvalueof/tikz/3D surface/ymin)/2:pgfkeysvalueof/tikz/3D surface/ymin,smooth] (pgfkeysvalueof/tikz/3D surface/xmin,x,pfft(2*x)) -- cycle;
path[opacity=0.3,left color=blue,right color=blue,middle color=blue!20,shading
angle=72]
plot[variable=x,domain=(pgfkeysvalueof/tikz/3D
surface/ymax+pgfkeysvalueof/tikz/3D surface/ymin)/2:pgfkeysvalueof/tikz/3D surface/ymax,smooth]
(pgfkeysvalueof/tikz/3D surface/xmax,x,pfft(2*x)) --
plot[variable=x,domain=pgfkeysvalueof/tikz/3D surface/ymax:(pgfkeysvalueof/tikz/3D
surface/ymax+pgfkeysvalueof/tikz/3D surface/ymin)/2,smooth] (pgfkeysvalueof/tikz/3D surface/xmin,x,pfft(2*x)) -- cycle;
draw plot[variable=x,domain=pgfkeysvalueof/tikz/3D surface/ymin:pgfkeysvalueof/tikz/3D surface/ymax,smooth]
(pgfkeysvalueof/tikz/3D surface/xmax,x,pfft(2*x)) --
plot[variable=x,domain=pgfkeysvalueof/tikz/3D surface/ymax:pgfkeysvalueof/tikz/3D surface/ymin,smooth]
(pgfkeysvalueof/tikz/3D surface/xmin,x,pfft(2*x)) -- cycle;
endtikzpicture
enddocument
The tikz-3dplot
package allows you to draw things in 3d and perform orthographic projections.
documentclass[tikz,border=3.14mm]standalone
usepackagetikz-3dplot
begindocument
tdplotsetmaincoords60110
begintikzpicture[tdplot_main_coords,>=stealth,declare function=%
pfft(x)=pi+0.3*sin(deg(x));]
draw[->] (0,0,0) coordinate (O) -- (5,0,0) coordinate(X) node[pos=1.1]$x$;
draw[->] (O) -- (0,5,0) node[pos=1.1]$y$;
draw[->] (O) -- (0,0,5) node[pos=1.1]$z$;
draw[thick] plot[variable=x,domain=0.8*pi:1.1*pi,smooth] (2.2,x,pfft(2*x))
coordinate (T1)--
plot[variable=x,domain=1.1*pi:0.8*pi,smooth] (0.8,x,pfft(2*x)) coordinate
(T3)-- cycle;
draw (2.2,0.8*pi,0) coordinate (B4)-- (2.2,1.1*pi,0) coordinate (B1)
-- (0.8,1.1*pi,0) coordinate (B2) -- (0.8,0.8*pi,0) coordinate (B3) -- cycle;
path (2.2,0.8*pi,pfft(2*0.8*pi)) coordinate (T4)
(0.8,1.1*pi,pfft(2*1.1*pi)) coordinate (T2);
foreach X in 1,...,4
draw (BX) -- (TX);
path[opacity=0.3,left color=blue,right color=blue,middle color=blue!20,shading
angle=72]
plot[variable=x,domain=0:1.1*pi,smooth] (3,x,pfft(2*x)) --
plot[variable=x,domain=1.1*pi:0,smooth] (0,x,pfft(2*x)) -- cycle;
path[opacity=0.3,left color=blue,right color=blue,middle color=blue!20,shading
angle=72]
plot[variable=x,domain=1.1*pi:2.2*pi,smooth] (3,x,pfft(2*x)) --
plot[variable=x,domain=2.2*pi:1.1*pi,smooth] (0,x,pfft(2*x)) -- cycle;
draw plot[variable=x,domain=0:2.2*pi,smooth] (3,x,pfft(2*x)) --
plot[variable=x,domain=2.2*pi:0,smooth] (0,x,pfft(2*x)) -- cycle;
endtikzpicture
enddocument
You may want to store the parameters in pgf keys.
documentclass[tikz,border=3.14mm]standalone
usepackagetikz-3dplot
begindocument
tdplotsetmaincoords60110
foreach X in 0,...,35
pgfmathsetmacroObjymax1.6*pi+0.5*sin(10*X)*pi
begintikzpicture[tdplot_main_coords,>=stealth,declare function=%
pfft(x)=2+0.3*sin(deg(x));,/tikz/3D surface/.cd,
ymin/.initial=0,ymax/.initial=2.2*pi,xmin/.initial=1,xmax/.initial=4,
/tikz/3D object/.cd,
ymin/.initial=0.8*pi,ymax/.initial=Objymax,xmin/.initial=1.8,xmax/.initial=3.2]
draw[->] (0,0,0) coordinate (O) -- (5,0,0) coordinate(X) node[pos=1.1]$x$;
draw[->] (O) -- (0,5,0) node[pos=1.1]$y$;
draw[->] (O) -- (0,0,5) node[pos=1.1]$z$;
draw[thick] plot[variable=x,domain=pgfkeysvalueof/tikz/3D object/ymin:pgfkeysvalueof/tikz/3D object/ymax,smooth]
(pgfkeysvalueof/tikz/3D object/xmax,x,pfft(2*x))
coordinate (T1)--
plot[variable=x,domain=pgfkeysvalueof/tikz/3D object/ymax:pgfkeysvalueof/tikz/3D object/ymin,smooth]
(pgfkeysvalueof/tikz/3D object/xmin,x,pfft(2*x)) coordinate
(T3)-- cycle;
draw (pgfkeysvalueof/tikz/3D object/xmax,pgfkeysvalueof/tikz/3D object/ymin,0) coordinate (B4)--
(pgfkeysvalueof/tikz/3D object/xmax,pgfkeysvalueof/tikz/3D
object/ymax,0) coordinate (B1)
-- (pgfkeysvalueof/tikz/3D object/xmin,pgfkeysvalueof/tikz/3D object/ymax,0) coordinate (B2) -- (pgfkeysvalueof/tikz/3D object/xmin,pgfkeysvalueof/tikz/3D object/ymin,0) coordinate (B3) -- cycle;
path (pgfkeysvalueof/tikz/3D object/xmax,pgfkeysvalueof/tikz/3D object/ymin,pfft(2*pgfkeysvalueof/tikz/3D object/ymin)) coordinate (T4)
(pgfkeysvalueof/tikz/3D object/xmin,pgfkeysvalueof/tikz/3D
object/ymax,pfft(2*pgfkeysvalueof/tikz/3D object/ymax)) coordinate (T2);
foreach X in 1,...,4
draw (BX) -- (TX);
path[opacity=0.3,left color=blue,right color=blue,middle color=blue!20,shading
angle=72]
plot[variable=x,domain=pgfkeysvalueof/tikz/3D surface/ymin:(pgfkeysvalueof/tikz/3D
surface/ymax+pgfkeysvalueof/tikz/3D surface/ymin)/2,smooth]
(pgfkeysvalueof/tikz/3D surface/xmax,x,pfft(2*x)) --
plot[variable=x,domain=(pgfkeysvalueof/tikz/3D
surface/ymax+pgfkeysvalueof/tikz/3D surface/ymin)/2:pgfkeysvalueof/tikz/3D surface/ymin,smooth] (pgfkeysvalueof/tikz/3D surface/xmin,x,pfft(2*x)) -- cycle;
path[opacity=0.3,left color=blue,right color=blue,middle color=blue!20,shading
angle=72]
plot[variable=x,domain=(pgfkeysvalueof/tikz/3D
surface/ymax+pgfkeysvalueof/tikz/3D surface/ymin)/2:pgfkeysvalueof/tikz/3D surface/ymax,smooth]
(pgfkeysvalueof/tikz/3D surface/xmax,x,pfft(2*x)) --
plot[variable=x,domain=pgfkeysvalueof/tikz/3D surface/ymax:(pgfkeysvalueof/tikz/3D
surface/ymax+pgfkeysvalueof/tikz/3D surface/ymin)/2,smooth] (pgfkeysvalueof/tikz/3D surface/xmin,x,pfft(2*x)) -- cycle;
draw plot[variable=x,domain=pgfkeysvalueof/tikz/3D surface/ymin:pgfkeysvalueof/tikz/3D surface/ymax,smooth]
(pgfkeysvalueof/tikz/3D surface/xmax,x,pfft(2*x)) --
plot[variable=x,domain=pgfkeysvalueof/tikz/3D surface/ymax:pgfkeysvalueof/tikz/3D surface/ymin,smooth]
(pgfkeysvalueof/tikz/3D surface/xmin,x,pfft(2*x)) -- cycle;
endtikzpicture
enddocument
edited 51 mins ago
answered 3 hours ago
marmotmarmot
123k6160301
123k6160301
add a comment |
add a comment |
To help you get started:
documentclassarticle
usepackagetikz
begindocument
begintikzpicture[x=(210:1cm),y=(0:1cm),z=(90:1cm)]
draw (0,0,0) -- (3,0,0) -- (3,3,0)--(0,3,0)--cycle;
draw (3,0,0) -- (3,0,4) .. controls (3,1,3.5) and (3,2,3) .. (3,3,3) -- (3,3,0);
draw (3,3,3) .. controls (2,3,3) and (1,3,5) .. (0,3,5)--(0,3,0);
draw (0,3,5) .. controls (0,2,4) and (0,1,4) .. (0,0,4)--(0,0,0);
draw (0,0,4) -- (3,0,4);
endtikzpicture
enddocument
add a comment |
To help you get started:
documentclassarticle
usepackagetikz
begindocument
begintikzpicture[x=(210:1cm),y=(0:1cm),z=(90:1cm)]
draw (0,0,0) -- (3,0,0) -- (3,3,0)--(0,3,0)--cycle;
draw (3,0,0) -- (3,0,4) .. controls (3,1,3.5) and (3,2,3) .. (3,3,3) -- (3,3,0);
draw (3,3,3) .. controls (2,3,3) and (1,3,5) .. (0,3,5)--(0,3,0);
draw (0,3,5) .. controls (0,2,4) and (0,1,4) .. (0,0,4)--(0,0,0);
draw (0,0,4) -- (3,0,4);
endtikzpicture
enddocument
add a comment |
To help you get started:
documentclassarticle
usepackagetikz
begindocument
begintikzpicture[x=(210:1cm),y=(0:1cm),z=(90:1cm)]
draw (0,0,0) -- (3,0,0) -- (3,3,0)--(0,3,0)--cycle;
draw (3,0,0) -- (3,0,4) .. controls (3,1,3.5) and (3,2,3) .. (3,3,3) -- (3,3,0);
draw (3,3,3) .. controls (2,3,3) and (1,3,5) .. (0,3,5)--(0,3,0);
draw (0,3,5) .. controls (0,2,4) and (0,1,4) .. (0,0,4)--(0,0,0);
draw (0,0,4) -- (3,0,4);
endtikzpicture
enddocument
To help you get started:
documentclassarticle
usepackagetikz
begindocument
begintikzpicture[x=(210:1cm),y=(0:1cm),z=(90:1cm)]
draw (0,0,0) -- (3,0,0) -- (3,3,0)--(0,3,0)--cycle;
draw (3,0,0) -- (3,0,4) .. controls (3,1,3.5) and (3,2,3) .. (3,3,3) -- (3,3,0);
draw (3,3,3) .. controls (2,3,3) and (1,3,5) .. (0,3,5)--(0,3,0);
draw (0,3,5) .. controls (0,2,4) and (0,1,4) .. (0,0,4)--(0,0,0);
draw (0,0,4) -- (3,0,4);
endtikzpicture
enddocument
answered 3 hours ago
JPiJPi
10.2k21551
10.2k21551
add a comment |
add a comment |
Ícaro Viterbre is a new contributor. Be nice, and check out our Code of Conduct.
Ícaro Viterbre is a new contributor. Be nice, and check out our Code of Conduct.
Ícaro Viterbre is a new contributor. Be nice, and check out our Code of Conduct.
Ícaro Viterbre 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');
);
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%2f488865%2f3d-volume-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
3
Welcome to TeX.SE! What have you tried so far?
– Kurt
3 hours ago