\documentclass{article}
\usepackage{tikz}
\usepackage{pgfmath}
\usetikzlibrary{calc,intersections,through,backgrounds}
\begin{document}
\begin{tikzpicture}[scale=2]
\draw[step=5mm, gray, very thin] (-4,-4) grid (4,4) ;
\draw[thin, blue] (-3,0) -- (3,0) ;
\draw[thin, blue] (0,-3) -- (0,3) ;
\draw (2.5,0) -- (1.5,2) -- (0,0);
\draw[dotted] (1.5,1) -- (1.5,2) ;
\draw[dotted] (0,0) -- (1.5,1) ;
\draw (0,0) -- (-0.5,1.5) -- (1.5,2) ;
\draw (0,0) -- (2,-1) -- (2.5,0) ;
\draw[dashed] (0,0) -- (2.5,0) ;
\draw (2,-1) -- (1.5,2) ;
\draw (0,0) -- (0.5,-1) -- (2,-1) ;
\path [name path = ligne1] (0.5,-1) -- (2.5,0) ;
\path [name path = ligne2] (0,0) -- (2,-1) ;
\path [name intersections={of= ligne1 and ligne2, by={ x12 }}];
\draw[dashed] (0.5,-1) -- (x12) ;
\draw[dotted] (x12) -- (2.5,0) ;
\path [name path = ligne3] (1.5,1) -- (0.5,-1) ;
\path [name intersections={of= ligne2 and ligne3, by={ x23 }}];
\draw[dashed] (0.5,-1) -- (x23) ;
\draw[dotted] (x23) -- (1.5,1) ;
\draw (-0.5,1.5) -- (-0.5,0.25) -- (0.5,-1) ;
\path [name path = ligne4] (-0.5,0.25) -- (1.5,1) ;
\path [name path = ligne5] (0,0) -- (-0.5,1.5) ;
\path [name path = ligne6] (0,0) -- (1.5,2) ;
\path [name intersections={of= ligne4 and ligne5, by={ x45 }}];
\path [name intersections={of= ligne4 and ligne6, by={ x46 }}];
\draw[dashed] (-0.5,0.25) -- (x45) ;
\draw[dashed] (x45) -- (x46)(1.5,1) ;
\draw[dotted] (x46) -- (1.5,1) ;
\draw (0,0) -- (-0.5,0.25) ;
\path [name path = ligne7] (2,-1) -- (1.5,2) ;
\path [name path = ligne8] (2.5,0) -- (1.5,1) ;
\path [name intersections={of= ligne7 and ligne8, by={ x78 }}];
\draw[dotted] (2.5,0) -- (x78) ;
\draw[dotted ] (x78) -- (1.5,1) ;
\path [name path = ligne9] (-0.5,1.5) -- (1.5,1) ;
\path [name intersections={of= ligne6 and ligne9, by={ x69 }}];
\draw[dashed] (-0.5,1.5) -- (x69) ;
\draw[dotted] (x69) -- (1.5,1) ;
\path [name path = ligne10] (0,0) -- (2.5,0) ;
\path [name path=cercle1] (0,0) circle [radius = 1] ;
\path [name intersections={of= ligne10 and cercle1, by={ a }}];
\path [name intersections={of= ligne6 and cercle1, by={ b }}];
\path [name path = ligne11] (2.5,0) -- (1.5,2) ;
\foreach \n in {0,1,2,3,4,5,6,7,8,9,10}
{\path [name path = div1\n] (0,0) -- ({2.5 -(1*\n)/10},{(2*\n)/10}) ;
\path [name intersections={of= cercle1 and div1\n, by={ a\n }}] ;
} ;
\draw[blue,smooth, name path = arca] plot coordinates {(a0) (a1) (a2) (a3) (a4) (a5) (a6) (a7) (a8) (a9) (a10)} ;
\path[name path = cercle2] (0,0) circle [x radius = 1cm, y radius =0.4cm] ;
\foreach \n in {0,1,2,3,4,5,6,7,8,9,10}
{\path [name path = div2\n] (0,0) -- ({2.5 -(1*\n)/10},{(1*\n)/10}) ;
\path [name intersections={of= cercle2 and div2\n, by={ b\n }}] ;
} ;
\draw[green,smooth, name path = arcb] plot coordinates {(b0) (b1) (b2) (b3) (b4) (b5) (b6) (b7) (b8) (b9) (b10)} ;
\path [name path=prearcc] (a10) -- (b10) ;
\coordinate (c) at ($(a10)!0.5!(b10)$) ;
\draw [name path = cercle3]
let \p1 = ($ (a10) - (c) $),
\n2 = {veclen(\x1,\y1)}
in
(c) circle [x radius = 0.25mm, y radius = \n2,rotate = -11] ;
\coordinate (c') at ($(a10) - (b10)$) ;
\coordinate (c'') at ($0.1*(c')$) ;
\foreach \i in {0,1,2,3,4,5,6,7,8,9,10}
{\path [draw,red,name path = divnew\i] (c) -- ($ { \i * (c'')} $) ;
\path [name intersections={of= cercle3 and divnew\i, by={ c\i }}] ;
} ;
\end{tikzpicture}
\end{document}
Asked
Active
Viewed 88 times
6
MarcelBenard
- 61
1 Answers
3
I feel nervous to comment something but... just to enrich this answer.
In the first course of TeX we are taught that if anything gets wrong, add braces. For instance $10^10$. However TikZ works in another way. As @percusse explained in this answer, the core of TikZ repeatedly check the next character and decide what to do next. It will not work if it meets useless braces. So that is the first lesson: add no braces unless necessary.
Then, TikZ uses a TeX feature to check your spelling. Borrowing @percusse's example:
def\tikz@collect@coordinate@onpath@#1oordinate{%
\pgfutil@ifnextchar[{\tikz@@collect@coordinate@opt#1}{\tikz@@collect@coordinate@opt#1[]}}%}
Similarly, in tikzlibrarycalc.code.tex it defines:
\def\tikz@cc@parse@factor#1*({%
\pgfmathparse{#1*\tikz@cc@factor}%
\let\tikz@cc@factor=\pgfmathresult%
\tikz@cc@coordinate(%)
}
So that is the second lesson: add no spaces unless necessary.
($0.1*(c')$)with no accident, so remove{}in(${\i*(c'')}$)– Symbol 1 Aug 07 '16 at 15:57