11

I would like to produce a tikz version of this image I drew by hand, which I would include in my thesis
hand draw

I'm having troubles with two things specifically:

  • drawing the planes perpendicular to l.t.c. and l.o.s.
  • projecting r on the plane centred at the origin (giving the vector R) and V on the plane centred at r (giving the vector V⟂)

This is how far I've got tikz production

and here's my code

\documentclass[tikz, border=10pt]{standalone}
\usepackage{tikz, tikz-3dplot}
\usepackage{xcolor, graphicx}
\usepackage{bm}
\usetikzlibrary{arrows, calc, intersections}

\begin{document}
\begin{tikzpicture}[scale = 0.5]

% draw axes of frame
\draw [thin,->] (0,0,0) -- (5,0,0) node[below right] {\small$y$};
\draw [thin,->] (0,0,0) -- (0,5,0) node[above] {\small$z$};
\draw [thin,->] (0,0,0) -- (0,0,9) node[below left] {\small$x$};
% draw sphere to resemble the system
\shade [ball color = gray!40, opacity = 0.4] (0,0) circle (4cm);
% define coordinate of origin
\coordinate (C) at (0,0,0);
% define coordinate of O
\coordinate (O) at (20, -4, 4){};
% draw vector from origin to O
\draw[name path=C--O] (C) -- (O) node[below](){Observer};
\node[rotate=-13] at (12,-4) {$ltc$};
% define coordinate of S
\coordinate (S) at (3.6, 3.2, 2){};
% draw vector from origin to S
\draw [->, name path=C--S] (C) -- (S) node at (1.6,0.4) {$\bm{r}$};
% draw vector from O to S
\draw [name path=O--S] (O) -- (S);
\node [rotate=-25] at (11,-1.3) {$los$};
% draw orthogonal to segment C--O
\draw [thick, name path=C--R] (C) -- ($(C)!4cm!102:(O)$) node[right] at (0.2,2) {R};
\draw [->] (-0.5,0.5,0) arc (90:300:1 and 0.6) node[left] at (-1.4,-0.6) {$\theta$};

\coordinate (V) at (6,4,2);
\draw [->, thick] (S) -- (V) node[above right] {$\bm{v}$};
\draw [->] (5,3.5,2) arc (30:-35:1.4 and 0.8) node[right] at (4.3,2.3) {$\phi$};
\draw [->] (3.5,4,2) arc (90:180:0.6 and 0.8) node[left] at (2.3,3) {$\omega$};

\draw [<-, blue] (-0.8,-4.2) arc (180:270:1 and 0.8);
\node [blue] at (2.5,-5) {dwarf galaxy};

\end{tikzpicture}
\end{document}

I've drawn R by rotating a line orthogonal to the path C--O, but it's incorrect.

I need a plane perpendicular to this path, passing through the origin and a coplanar vector R, extending from the origin to the continuation of l.o.s.

Is there some elegant and precise way of doing this?
Any indication is highly appreciated. Thanks

PS: You might notice that I haven't rotated the frame. That's because I couldn't figure it out. I tried playing with \tdplotsetmaincords{}{} but the way it rotates the axes is quite mysterious to me. So I gave up and resorted to a dirty and quick solution: simply labelling the axes with different names

  • 3
    I think that will all be straightforward to achieve. However, your axes are not related by an SO(3) rotation to the standard transformation, i.e. the determinant of your transformation is negative. Do you insist on this sign, i.e. is it on purpose, or would you also be interested in an answer using the standard orientation? – marmot Dec 6 '18 at 23:26
  • I did not rotate the axis because I wasn't able to (I know how rotations work, but the function to do so defied my control) – andrea Dec 7 '18 at 18:23
  • @marmot Please let me know if anything could be simplified, I appreciate that! – zyy Dec 8 '18 at 3:38
6

I could not understand what angles omega and theta are indicating, other than that, I think I have reproduced what you drew with your hand

\documentclass[tikz, border = 10pt]{standalone}

\usepackage{tikz-3dplot}
\usetikzlibrary{arrows.meta, calc}

\usepackage{xcolor}
\usepackage{bm}
\usepackage[e]{esvect}

\begin{document}

\tdplotsetmaincoords{60}{125}
\begin{tikzpicture}[tdplot_main_coords]

\draw[-{Stealth[round, scale = 1.3]}] (0,0,0) -- (9, 0, 0) node[anchor = north east]{\small$x$};
\draw[-{Stealth[round, scale = 1.3]}] (0,0,0) -- (0, 7, 0) node[anchor = north west]{\small$y$};
\draw[-{Stealth[round, scale = 1.3]}] (0,0,0) -- (0, 0, 7) node[anchor = south]{\small$z$};

\shade [ball color = gray!40, opacity = 0.4] (0, 0) circle (3 cm); %% 3 cm is equivalently 3 in coordinate

\coordinate (C) at (0,0,0);
\coordinate (O) at (4, 20, -4){};
\coordinate (oext) at (-0.2, -1, --0.2){};
\coordinate (S) at (1, 2, 2){};
\coordinate (V) at (1, 4, 3);
\coordinate (R) at ({8 / 11}, {2 - (18 / 11)}, {2 + (6 / 11)});
\coordinate (vper) at ({31 / 41}, {4 - (60 / 41)}, {3 + (20 / 41)});
\coordinate (vpar) at ({51 / 41}, {2 + (60 / 41)}, {2 - (20 / 41)});
\coordinate (vii) at ({1 / 3}, {5 / 3}, {- 1 / 3});

\filldraw [black] (4, 20, -4) circle (1pt);
\draw (C) -- (O) node[anchor = west]{observer};
\draw (O) -- (S);
\draw [-{Stealth[round, scale = 1.3]}] (C) -- (S);
\node [anchor = east] at (0.8, 1.6, 1.6) {$\vv{\bm{r}}$};
\draw [-{Stealth[round, scale = 1.3]}, thick] (S) -- (V) node [above right] {$\vv{\bm{v}}$};
\draw [dashed] (C) -- (oext);

\node [rotate = -23, anchor = north] at (2, 10, -2) {$ltc$};
\node [rotate = -30, anchor = south] at (2.5, 11, -1) {$los$};

\coordinate (ltcbl) at (1, -0.4, -1){};
\coordinate (ltcbr) at (-1, 0, -1){};
\coordinate (ltctl) at (1, 0, 1){};
\coordinate (ltctr) at (-1, 0.4, 1){};
\draw [red] (ltcbl) -- (ltcbr) -- (ltctr) -- (ltctl) -- (ltcbl);

\coordinate (losbl) at (0, {2 - (1/6)}, 1){};
\coordinate (losbr) at (2, 1.5, 1){};
\coordinate (lostl) at (0, 2.5, 3){};
\coordinate (lostr) at (2, {2 + (1/6)}, 3){};
\draw [blue] (losbl) -- (losbr) -- (lostr) -- (lostl) -- (losbl);

\draw [-{Stealth[round, scale = 1.3]}, color = red, thick] (C) -- (R);
\draw [dashed] (R) -- (S);
\node [anchor = east] at (R) {$R$};

\draw [-{Stealth[round, scale = 1.3]}, color = blue, thick] (S) -- (vper);
\draw [dashed] (vper) -- (V);
\node [anchor = east] at ({36 / 41}, {3 - (30 / 41)}, {2.5 + (10 / 41)}) {$\vv{\bm{v}}_{\bot}$};
\draw [-{Stealth[round, scale = 1.3]}, color = blue, thick] (S) -- (vpar);
\draw [dashed] (vpar) -- (V);
\node [anchor = north] at ({46 / 41}, {2 + (30 / 41)}, {2 - (10 / 41)}) {$\vv{\bm{v}}_{eos}$};
\draw [green] ({46 / 41}, {2 + (30 / 41)}, {2 - (10 / 41)}) arc (85:155:1);
\node [green] at (1.2, 3.4, 2.3) {$\phi$};

\draw [dashed] (S) -- (vii) node [below] {$vii$};

\draw [{Stealth[round, scale = 1.3]}-, gray] (-0.8, -4.2, 0) arc (180:270:1 and 0.8);
\node [gray] at (2, -4, 0.5) {dwarf galaxy};

\end{tikzpicture}

\end{document}

The output looks like

sphere

There are a few points I would like to make clear

  1. I changed the coordinate system to a conventional view, which is much nicer to work with.
  2. Since you did not specify where point S should be, I put it right on the sphere.
  3. For the sake of convenience, I chose the radius of sphere to be 3 so that its square can be break down to 1 + 4 + 4, which are all square numbers.
  4. I think drawing the planes perpendicular to los and ltc makes the picture busy and recommend removing them.
  • 1
    I am speechless :O it's beautiful! thank you sooooo much – andrea Dec 7 '18 at 17:57
  • 1
    I'm now on a journey but obviously you could drop intersections and all name path as I don't see where you are using them. Then you load tikz twice, once by putting it into the arguments of standalone and then by loading it explicitly. Then you do not need to load graphicx. The coordinate of S is nice, I had the same (up to signs), but you may want to draw it in tdplot_screen_coords in case you ever add transform shape for the whole thingy. Otherwise this a really great answer. (+1) – marmot Dec 8 '18 at 5:17
  • 1
    @zyy If you find a an intersection point of two lines in 3d, it won't necessarily be a true intersection point. I.e. the lines may never intersect, but their projections may, so these are not necessarily true intersections. – marmot Dec 9 '18 at 4:38
  • 1
    @zyy I do not want but it is slightly easier to find the normal vectors that way. (One could also let TikZ find the normals and/or use spherical coordinates for S.) – marmot Dec 11 '18 at 21:20
  • 1
    @marmot Thanks for your advice, I have updated my answer accordingly. – zyy Dec 11 '18 at 22:00

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.