我正在尝试使用 tikzpicture 来绘制不同的圆锥曲线。
最后,我想反射我围绕 y 轴绘制的两条圆弧,得到一条双曲线,但我不知道该怎么做。反射的部分没有出现在我想要的位置。
这是我的代码:
\begin{tikzpicture}
\draw (0,0) ellipse (1cm and 0.3cm);
\draw (0,-3) -- (-1,0);
\draw (0,-3) -- (1,0);
\draw (-1,-6) -- (0,-3);
\draw (1,-6) -- (0,-3);
\draw (0,-6) ellipse (1cm and 0.3 cm);
\draw (2,-3) circle (0.75cm);
\draw (4.5,-3) ellipse (1cm and 0.4 cm);
\draw (7,-3.5) parabola (6.5,-2) ;
\draw (7,-3.5) parabola (7.5,-2);
\draw (9, -2.5) arc (5:45:2);
\draw (9, -2.5) arc (5:-45:2);
\end{tikzpicture}
我明白了:
为了反映弧线,我使用以下代码:
\begin{scope}[yscale=1,xscale=-1]
\draw (9, -2.7) arc (5:45:1);
\draw (9, -2.7) arc (5:-45:1);
\end{scope}
但后来我得到了这个:
有人能帮我解决这个问题吗?任何帮助我都会感激不尽。提前谢谢大家!
答案1
弧线之所以移动这么远,是因为水平坐标9
被映射到了-9
。反射事物的一个方便方法是将它们绘制在图片中,该图片可以反射(或以其他方式变换)。我不知道这两个弧之间的关系,但您可以调整水平坐标(现在是 )-0.5
来获得您想要的结果。(或者您给我一个提示。)
\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\begin{tikzpicture}[pics/my arc/.style={code={
\draw (-0.5, -2.5) arc (5:45:2);
\draw (-0.5, -2.5) arc (5:-45:2);}}]
\draw (0,0) ellipse (1cm and 0.3cm);
\draw (0,-3) -- (-1,0);
\draw (0,-3) -- (1,0);
\draw (-1,-6) -- (0,-3);
\draw (1,-6) -- (0,-3);
\draw (0,-6) ellipse (1cm and 0.3 cm);
\draw (2,-3) circle (0.75cm);
\draw (4.5,-3) ellipse (1cm and 0.4 cm);
\draw (7,-3.5) parabola (6.5,-2) ;
\draw (7,-3.5) parabola (7.5,-2);
\path (9,0) pic {my arc} pic[xscale=-1] {my arc};
\end{tikzpicture}
\end{document}
或者,您可以引入一种反映移位的 x 轴或 y 轴的样式。
\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\begin{tikzpicture}[reflect at x/.style={xshift=#1*1cm,xscale=-1,xshift=-1*#1*1cm},
reflect at y/.style={yshift=#1*1cm,yscale=-1,yshift=-1*#1*1cm}]
\draw (0,0) ellipse (1cm and 0.3cm);
\draw (0,-3) -- (-1,0);
\draw (0,-3) -- (1,0);
\draw (-1,-6) -- (0,-3);
\draw (1,-6) -- (0,-3);
\draw (0,-6) ellipse (1cm and 0.3 cm);
\draw (2,-3) circle (0.75cm);
\draw (4.5,-3) ellipse (1cm and 0.4 cm);
\draw (7,-3.5) parabola (6.5,-2) ;
\draw (7,-3.5) parabola (7.5,-2);
\draw (9, -2.5) arc (5:45:2);
\draw (9, -2.5) arc (5:-45:2);
\begin{scope}[reflect at x=9.5]
\draw (9, -2.5) arc (5:45:2);
\draw (9, -2.5) arc (5:-45:2);
\end{scope}
\end{tikzpicture}
\end{document}