6

I was trying to create a circumference perpendicular to a line similar to this

enter image description here

but I only see a tutorial for creating in a axis-plane (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}
7

If full ellipse is good enough you can just rotate it. If you need an ellipse with break you can draw it using \pgfpatharcaxes (or similar command).

\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}

enter image description here

  • +1, but I would remove the draw options to the balls :) – Claudio Fiandrino Apr 15 '14 at 11:57
2

Something like this?

\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}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.