我试图创建一个垂直于一条线的圆周,类似于这个
但我只看到了在轴平面 (xy, xz, yz) 中创建的教程
\documentclass[tikz, border=15mm]{standalone}
\usetikzlibrary{arrows,calc, decorations.markings, intersections}
\begin{document}
\begin{tikzpicture}[scale=.8]
\draw (0,0,0) -- (xyz cs:x=6);
\draw (0,0,0) -- (xyz cs:y=6);
\draw[name path=axe] (.5,.5)--(5,5);
%
\node[inner sep=0, outer sep=0] at (1,2) (a) {};
\node[inner sep=0, outer sep=0] at (2,3.5) (b) {};
\node[inner sep=0, outer sep=0] at (3,5) (c) {};
\node[inner sep=0, outer sep=0] at (4,4) (d) {};
\node[inner sep=0, outer sep=0] at (4,2.5) (e) {};
\node[inner sep=0, outer sep=0] at (3,1) (f) {};
%
\shadedraw[name path=mold,inner color=brown!10,outer color=brown!70,draw=brown!70]
plot [smooth cycle, tension=.8] coordinates { (a) (b) (c) (d) (e) (f)};
%
\draw [dashed, name intersections={of=axe and mold}]
(intersection-1) --(intersection-2);
\fill [name intersections={of=axe and mold}]
(intersection-1) circle (2pt)
(intersection-2) circle (2pt)
(2.2,2.2) circle (2pt)
(3.2,3.2) circle (2pt);
\end{tikzpicture}
\end{document}
答案1
如果完整的椭圆足够好,您可以旋转它。如果您需要带中断的椭圆,您可以使用\pgfpatharcaxes
(或类似命令)绘制它。
\documentclass[tikz, border=15mm]{standalone}
\usepackage{xcolor}
\usetikzlibrary{arrows,calc, decorations.markings, intersections}
\begin{document}
\begin{tikzpicture}[scale=.8]
\draw (0,0,0) -- (xyz cs:x=6);
\draw (0,0,0) -- (xyz cs:y=6);
\draw[name path=axe] (.5,.5)--(5,5);
\node[inner sep=0, outer sep=0] at (1,2) (a) {};
\node[inner sep=0, outer sep=0] at (2,3.5) (b) {};
\node[inner sep=0, outer sep=0] at (3,5) (c) {};
\node[inner sep=0, outer sep=0] at (4,4) (d) {};
\node[inner sep=0, outer sep=0] at (4,2.5) (e) {};
\node[inner sep=0, outer sep=0] at (3,1) (f) {};
\shadedraw[name path=mold,inner color=brown!10,outer color=brown!70,draw=brown!70]
plot [smooth cycle, tension=.8] coordinates { (a) (b) (c) (d) (e) (f)};
\draw [dashed, name intersections={of=axe and mold}]
(intersection-1) --(intersection-2);
\fill [name intersections={of=axe and mold}]
(intersection-1) circle (2pt)
(intersection-2) circle (2pt)
(2.2,2.2) circle (2pt)
(3.2,3.2) circle (2pt);
\definecolor{lightblue}{RGB}{42,174,229}
\pgfsetlinewidth{2\pgflinewidth}
\pgfsetcolor{lightblue}
\draw[rotate=45] ({sqrt(2)*2.2},0) ellipse (0.2 and 1);
\shade[thin,draw,ball color=green] ({2.2+1/sqrt(2)},{2.2-1/sqrt(2)})
circle (0.1cm) node[xshift=4pt,yshift=-2pt]{\tiny{A}};
\begin{pgfscope}
\pgftransformrotate{45}
\pgfpathmoveto{\pgfpoint{sqrt(2)*3.2cm+0.15cm}{0.07cm}}
\pgfpatharcaxes{5}{355}{\pgfpoint{0.15cm}{0mm}}{\pgfpoint{0}{0.75cm}}
\pgfusepath{draw}
\end{pgfscope}
\shade[thin,draw,ball color=green] ({3.2+1/sqrt(2)*0.7},{3.2-1/sqrt(2)*0.7})
circle (0.1cm) node[xshift=5pt,yshift=-1pt]{\tiny{B}};
\end{tikzpicture}
\end{document}
答案2
像这样吗?
\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\begin{scope}[rotate=60]
\draw (0,0) --++(0:5);
\draw[very thick,blue!50] (2,0) ellipse[x radius=.5cm, y radius=2cm];
\draw[very thick,blue!50] (3.5,0) ellipse[x radius=.25cm, y radius=1cm];
\end{scope}
\begin{scope}[xshift=5cm]
\draw (0,0) --++(30:5);
\draw[very thick,blue!50] (30:2) ellipse[rotate=30, x radius=.5cm, y radius=2cm];
\draw[very thick,blue!50] (30:3.5) ellipse[rotate=30, x radius=.25cm, y radius=1cm];
\end{scope}
\end{tikzpicture}
\end{document}