为了绘制圆的一些切线,我使用了 (1,0) 处与圆相切的单个垂直线段,然后按如下循环旋转
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\foreach \t in {0,...,30}
{
\pgfmathsetmacro{\s}{360/30*\t}
\draw[rotate=\s](1,-2)--(1,2);
}
\end{tikzpicture}
\end{document}
我应该如何绘制第二个图?太晚了,我没法弄清楚。
答案1
我可以修改你之前的例子。这只是三角函数的一小部分:每个切线空间都在一个点的上方和下方几厘米处(cosX,罪X),因此您多使用几个\pgfmathsetmacro
电话。
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[very thick, blue] (0,0) circle [y radius=0.67cm, x radius=1cm];
\foreach \t in {0,...,30}
{
\pgfmathsetmacro{\s}{360/30*\t}
\pgfmathsetmacro{\x}{cos(\s+10)}
\pgfmathsetmacro{\y}{0.67*sin(\s+10)-3}
\pgfmathsetmacro{\yy}{\y+6}
\draw[thick, red] (\x, \y) -- (\x,\yy);
}
\end{tikzpicture}
\end{document}
答案2
对 Arun Debray 的回答只有一点小小的修改:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{backgrounds}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{1em}
\begin{document}
\begin{tikzpicture}
\draw[ultra thick, blue] (0,0) circle [y radius=0.67cm, x radius=1cm];
\foreach \t in {0,...,30}
{
\pgfmathsetmacro{\s}{360/30*\t}
\pgfmathsetmacro{\x}{cos(\s+10)}
\pgfmathsetmacro{\y}{0.67*sin(\s+10)-2}
\pgfmathsetmacro{\yy}{\y+4}
\ifnum\t<15
\scoped[on background layer]
\draw[thick,red!50] (\x, \y) -- (\x,\yy)
\else
\draw[thick,red] (\x, \y) -- (\x,\yy)
\fi;
}
\end{tikzpicture}
\end{document}
答案3
我稍微修改了你的答案并认为有人可能会觉得它有用。
\documentclass{article}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{tikz}
\usetikzlibrary{backgrounds}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{1em}
\begin{document}
\begin{tikzpicture}
%\draw (-2,-2.5) grid (3,3);
\draw[ultra thick, blue] (0,0) circle [y radius=0.5cm, x radius=1cm];
\foreach \t in {0,...,30}
{
\pgfmathsetmacro{\s}{360/30*\t}
\pgfmathsetmacro{\x}{cos(\s+10)}
\pgfmathsetmacro{\y}{0.5*sin(\s+10)-2}
\pgfmathsetmacro{\yy}{\y+4}
\ifnum\t<15
\scoped[on background layer]
\draw[thick,red!50] (\x, \y) -- (\x,\yy);
\else
\ifnum\t=20
\draw[thick, black] (\x, \y) -- (\x,\yy);
\else
\draw[thick,red] (\x, \y) -- (\x,\yy);
\fi;
\fi;
}
\node[blue] at (1.3,0) {$\mathcal{M}$};
\node[red] at (1.8,1.5) {$\mathcal{E} = T\mathcal{M}$};
\pgfmathsetmacro{\s}{360/30*20}
\pgfmathsetmacro{\x}{cos(\s+10)}
\pgfmathsetmacro{\y}{0.5*sin(\s+10)-2}
\pgfmathsetmacro{\yy}{\y+4}
\draw (\x, \yy/2+\y/2) node[circle, fill, inner sep=1pt, label=below:$p$] (p) {};
\node at (\x, \yy+0.2) {$T_p\mathcal{M}$};
\end{tikzpicture}
\end{document}