Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am trying to draw this image

My code is

\documentclass[11pt,a4paper]{book}
\usepackage{kerkis}
\usepackage{tikz}
\definecolor{Darkgreen}{rgb}{0,0.4,0}
\definecolor{Darkblue}{rgb}{0,0,0.4}
\begin{document}
\begin{tikzpicture}

\draw (0,0) ellipse (1cm and 3cm);
\draw (0,0) ellipse (0.7cm and 2.1cm);
%\draw (0cm,0cm) circle (2cm); 
%\draw (0cm,0cm) circle (3cm);

\draw (0,3) -- (3,4);
\draw (0,-3) -- (3,-2);

%% First clip 
\path[clip] (4cm,5cm) --  (4cm,-3cm) -- (-4,-3) -- (-4,5) -- cycle;
%%The circle 
%\node[circle,draw=black,minimum size=13cm] at (-10cm,1cm) (circ) {};

%\draw (3,4) arc (0:-30:13cm);
\draw (-9.5,1) circle (13cm);%This circle crosses desired points in a desired arc angle

\end{tikzpicture}
\end{document}

First of all I cannot realise the best way to draw the front side. I used ellipses and circles but I don't seem able to produce the same output. Secondly I can't find out how to make the arc on the right side be placed properly.

My ugly output is

share|improve this question
add comment

1 Answer 1

up vote 13 down vote accepted

A pragmatic and semi-automated one...

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric,calc}
\begin{document}
\begin{tikzpicture}
\begin{scope}[rotate=15]
\node[transform shape,ellipse,minimum height=2cm,minimum width=1cm,draw,outer sep=0] (a) {};
\clip[scale=0.8,postaction={line width=0.8pt,draw}] (a) circle (0.5 and 1);
\draw[scale=0.8] ([shift={($0.75*({cos(15)},{sin(15)})$)}]a) circle (0.5 and 1);
\draw(a.west) -- (a.east);
\end{scope}
\begin{scope}[rotate=15]
\draw (a.north) --  ++(0.75,0) arc (90:-90:0.5cm and 1cm-2\pgflinewidth) -- (a.south);
\draw (a.east) ++(0.75,0) -- ++(1cm,0) (a.west) ++(-0.75,0) -- ++(0.9cm,0);
\end{scope}
\end{tikzpicture}
\end{document}

enter image description here


Edit by Thanos:

\begin{tikzpicture}[scale=3]
\begin{scope}[rotate=15]
\node[transform shape,ellipse,minimum height=2cm,minimum width=1cm,draw,outer sep=0]     (a) {};
\clip[scale=0.8,postaction={line width=0.8pt,draw}] (a) circle (0.5 and 1);
\draw[scale=0.8] ([shift={($0.75*({cos(15)},{sin(15)})$)}]a) circle (0.5 and 1);
\draw(a.west) -- (a.east);
\end{scope}
\begin{scope}[rotate=15]
\draw (a.north) --  ++(0.75,0) arc (90:-90:0.5cm and 1cm-2\pgflinewidth) -- (a.south);
\draw[->] (a.east) ++(0.75,0) -- ++(1cm,0);
\draw (a.west) ++(-0.75,0) -- ++(0.9cm,0);
\node at (-1,0.2) {$\vec{V}$};
\draw[->] (0,0) -- (-0.17,0.72);
\draw[<-] (-0.2,0.92) -- (-0.2715,1.15);
\node[above] at (-0.272,1.15) {$db$};
\node[right] at (-0.09,0.36) {$b$};
\draw (0,1.05) -- (0.06,1.3);
\draw (0+0.8,1.05+0.02) -- (0.06+0.8,1.3+0.02);
\draw[<->] (0.03,1.175) -- (0.03+0.8,1.175+0.02);
\node[above] at (0.03+0.4,1.175+0.02) {$dx$};
\end{scope}
\end{tikzpicture}

share|improve this answer
    
You must be joking! That's why you have 30k! This is awsome! Thank you very much! I could have never made it by my self! This output is extraordinary, beyond any imagination!!!Thank you very much!!! –  Thanos Nov 3 '12 at 12:16
    
@Thanos Thank you for your kind words but I'm not sure if I got the perspective right. It's no more than eyeballing so this might need a more systematic approach if a more complex technical drawing is needed. I'm also not sure if I got the inner and outer lengths of the cylinder right or I need an ophthalmologist. ;) –  percusse Nov 3 '12 at 16:03
3  
@percusse: I think it looks perfect. But, do you have a link for the postaction/clip trickery. I don't think I have seen that before. –  Peter Grill Nov 3 '12 at 16:07
    
@percusse: No it'really perfect! I got lost in the code to be quite frank, but I tried to add the distances, not a flashy and sophisticated way like you and I got it to like a lot alike. Would you mind if I included the edited code and the output on my answer? –  Thanos Nov 3 '12 at 16:29
1  
@percusse +1 for the explanation. –  hpesoj626 Nov 14 '12 at 10:39
show 5 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.