General ⇒ How can I draw this cylinder
-
- Posts: 23
- Joined: Sat Oct 28, 2017 1:18 am
How can I draw this cylinder
I want to draw this picture, but I can't. My difficult is how can I make points on two circles of cylinder.
- Attachments
-
- ScreenHunter 33.png (25.48 KiB) Viewed 71445 times
- Stefan Kottwitz
- Site Admin
- Posts: 10290
- Joined: Mon Mar 10, 2008 9:44 pm
How can I draw this cylinder
Hi,
can you post the code here, that you already have?
Stefan
can you post the code here, that you already have?
If it's just the points, we don't have to work on drawing a cylinder etc. if you might have that already, that's why I ask for the code.Tran Van Toan wrote:how can I make points on two circles of cylinder
Stefan
LaTeX.org admin
-
- Posts: 23
- Joined: Sat Oct 28, 2017 1:18 am
How can I draw this cylinder
My cylinder.
Code: Select all
\documentclass[border=5]{standalone}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usetikzlibrary{shadings}
\begin{document}
\begin{tikzpicture}
\def\R{2}
\fill[top color = gray!50!black,
bottom color = gray!10,
middle color = gray,
shading = axis,
opacity = 0.25]
(0,0) circle (\R cm and 0.5cm);
\fill[left color = gray!50!black,
right color = gray!50!black,
middle color = gray!50,
shading = axis,
opacity = 0.25]
(\R,0) -- (\R,2*\R) arc (360:180:\R cm and 0.5cm)
-- (-\R,0) arc (180:360:\R cm and 0.5cm);
\fill[top color = gray!90!,
bottom color = gray!2,
middle color = gray!30,
shading = axis,
opacity = 0.25]
(0,2*\R) circle (\R cm and 0.5cm);
\draw (-\R,2*\R) -- (-\R,0) arc (180:360:\R cm and 0.5cm)
-- (\R,2*\R) ++ (-\R,0) circle (\R cm and 0.5cm);
\draw[densely dashed] (-\R,0) arc (180:0:\R cm and 0.5cm);
\end{tikzpicture}
\end{document}
-
- Posts: 23
- Joined: Sat Oct 28, 2017 1:18 am
How can I draw this cylinder
I tried
And got
Code: Select all
\documentclass[border=5]{standalone}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usetikzlibrary{shadings}
\begin{document}
\begin{tikzpicture}
\def\R{2}
\def\a{1}
\def\z{1}
\def\h{2*\R}
\fill[top color = gray!50!black,
bottom color = gray!10,
middle color = gray,
shading = axis,
opacity = 0.25]
(0,0) circle (\R cm and \a cm);
\fill[left color = gray!50!black,
right color = gray!50!black,
middle color = gray!50,
shading = axis,
opacity = 0.25]
(\R,0) -- (\R,\h) arc (360:180:\R cm and \a cm)
-- (-\R,0) arc (180:360:\R cm and \a cm);
\fill[top color = gray!90!,
bottom color = gray!2,
middle color = gray!30,
shading = axis,
opacity = 0.25]
(0,\h) circle (\R cm and \a cm);
\draw (-\R,\h) -- (-\R,0) arc (180:360:\R cm and \a cm)
-- (\R,\h) ++ (-\R,0) circle (\R cm and \a cm);
\draw[densely dashed] (-\R,0) arc (180:0:\R cm and \a cm);
\coordinate (B) at (0,0);
\coordinate (A) at ($(B)+(0,\h)$);
\coordinate (E) at (-\R,\h);
\coordinate (F) at (\R,\h);
\coordinate (G) at (-\R,0);
\coordinate (H) at (\R,0);
\coordinate (C) at ($(B) + (225:{\R} and {\a})$);
\coordinate (D) at ($(C)+(0,\h)$);
\tkzFillPolygon[pattern=north west lines](A,B,C,D)
\tkzDrawSegments[](A,D D,C E,G F,H)
\tkzDrawSegments[dashed](A,B B,C)
\tkzDrawPoints[fill = black,size = 2 pt](A,B,C,D)
\tkzLabelPoints[right](A,B)
\tkzLabelPoints[above](D)
\tkzLabelPoints[below](C)
\end{tikzpicture}
\end{document}
- Attachments
-
- ScreenHunter 37.png (87.69 KiB) Viewed 71426 times
-
- Posts: 23
- Joined: Sat Oct 28, 2017 1:18 am
How can I draw this cylinder
But not good at here. How can I repair?
- Attachments
-
- ScreenHunter 36.png (3.03 KiB) Viewed 71426 times
- Stefan Kottwitz
- Site Admin
- Posts: 10290
- Joined: Mon Mar 10, 2008 9:44 pm
How can I draw this cylinder
Looks already good! Change this line
to that one, removing the unnecessary two last segments:
Stefan
\tkzDrawSegments[](A,D D,C E,G F,H)
to that one, removing the unnecessary two last segments:
\tkzDrawSegments[](A,D D,C)
Stefan
LaTeX.org admin
-
- Posts: 23
- Joined: Sat Oct 28, 2017 1:18 am
How can I draw this cylinder
Thank you very much.