tikz/pgf 중에서 잘 안되는 것 중의 하나가 임의의 곡선에서 접선 그리는 것입니다.
그림에서 곡선과 직선의 교점을 구하는 데까지는 성공했는데 (intersection)
죽어도 그 점에서 접선을 못 그리겠어요.
며칠째 구글을 뒤져봐도 실마리를 전혀 못찾고 있습니다.
tikz 매뉴얼에 "tangent cs:"라는 부분이 나오긴 하는데, 그 부분을 잘 모르겠습니다.
*가급적 tkz-euclide, tkz-fnc 같은 패키지의 도움은 받지 않으려고 합니다.
사실, 곡선도 너무 허접하게 그렸어요. 양끝 두 점을 정하고 컨트롤 포인트 두 개를 찍어 둥글리는 원시적인 방법을...
경제학의 등량곡선 중의 하나인데 정확히 함수만 알아도 비슷하게 그리겠구만... \(\frac{a}{x^2}+ \frac{b}{x}\) 정도의 그래프 모양일 것 같은데...
\documentclass[nanum]{oblivoir}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,calc,intersections,decorations.markings,shapes.gates.logic.US,trees,positioning,datavisualization,datavisualization.formats.functions}
\begin{document}
\begin{tikzpicture}[>=stealth,font=\small]
\draw[very thin,color=gray,step=0.5,] (-1,-1) grid (8,8);
\draw[->] (-0.2,0) -- (8,0) node[below] {$X_d$ (국산)};
\draw[->] (0,-.2) -- (0,8) node[left] {$X_m$ (수입)};
\draw[name path=R,thick,domain=0:5] plot (\x,1.3*\x) node[right] {$R$};
\coordinate (a) at (.5,7.5);
\coordinate [label=right:{$X=10$}] (b) at (7.5,.3);
\coordinate (c) at ($(a)+(1,0)$);
\coordinate [label=right:{$X=15$}] (d) at ($(b)+(0,1)$);
% 곡선 그리기
\draw[name path=X10,thick,color=red] (a) .. controls (1,2.5) and (2.5,1) .. (b);
\draw[name path=X15,thick,color=blue] (c) .. controls (1.5,5) and (4,2) .. (d);
\path [name intersections={of=R and X10, by=A}];
\path [name intersections={of=R and X15, by=C}];
\node at (A)[right] {$A$};
\node at (C)[right] {$C$};
\end{tikzpicture}
\end{document}
KTUG 한국 텍 사용자 그룹