Graphics, Figures & Tables3D Orbits around Sphere, arc points or orbit coordinates pos

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
startrucky
Posts: 11
Joined: Mon Aug 18, 2014 2:02 pm

3D Orbits around Sphere, arc points or orbit coordinates pos

Post by startrucky »

I have again a question about some 3D tikz problem.
This is a crosspost to: http://tex.stackexchange.com/questions/ ... ositioning
Added german crosspost: http://texwelt.de/wissen/fragen/12291/3 ... umlaufbahn

The link to the overleaf (writelatex) section, I dont know if anybody can open it but here it is. https://www.overleaf.com/2433347sbhpck#/6330259/

Now to the actual problem:<br>
The issue is the use of the path command referring to a former defined plane. The coordinates of the blue and black dots work on the blue and green track. <br>
The orange dots are not on the plane they are supposed to, they should be on the red lines, where the O and o is, so please could someone help me find out what I am missing.

Code: Select all

Code, edit and compile here:
\documentclass{article}
\usepackage{tikz, tikz-3dplot}
\usetikzlibrary{calc,fadings,decorations.pathreplacing}
%% helper macros
\newcommand{\pgfmathsinandcos}[3]{%
\pgfmathsetmacro#1{sin(#3)}%
\pgfmathsetmacro#2{cos(#3)}%
}
\newcommand{\LongitudePlane}[3][current plane]{%
\pgfmathsinandcos\sinEl\cosEl{#2} % elevation
\pgfmathsinandcos\sint\cost{#3} % azimuth
\tikzset{#1/.style={cm={\cost,\sint*\sinEl,0,\cosEl,(0,0)}}}
}
\newcommand{\LatitudePlane}[3][current plane]{%
\pgfmathsinandcos\sinEl\cosEl{#2} % elevation
\pgfmathsinandcos\sint\cost{#3} % latitude
\pgfmathsetmacro\yshift{\cosEl*\sint}
\tikzset{#1/.style={cm={\cost,0,0,\cost*\sinEl,(0,\yshift)}}} %
}
\newcommand{\OrbitPlane}[3][current plane]{%
\pgfmathsinandcos\sinEl\cosEl{#2} % elevation
\pgfmathsinandcos\sint\cost{#3} % azimuth
\tikzset{#1/.style={cm={\cost,\sint*\sinEl,0,\cosEl,(0,0)}}}
}
\newcommand{\DrawLongitudeCircle}[2][1]{
\LongitudePlane{\angEl}{#2}
\tikzset{current plane/.prefix style={scale=#1}}
% angle of "visibility"
\pgfmathsetmacro\angVis{atan(sin(#2)*cos(\angEl)/sin(\angEl))} %
\draw[current plane] (\angVis:1) arc (\angVis:\angVis+180:1);
\draw[current plane,dashed] (\angVis-180:1) arc (\angVis-180:\angVis:1);
}
\newcommand{\DrawLatitudeCircle}[2][1]{
\LatitudePlane{\angEl}{#2}
\tikzset{current plane/.prefix style={scale=#1}}
\pgfmathsetmacro\sinVis{sin(#2)/cos(#2)*sin(\angEl)/cos(\angEl)}
% angle of "visibility"
\pgfmathsetmacro\angVis{asin(min(1,max(\sinVis,-1)))}
\draw[current plane] (\angVis:1) arc (\angVis:-\angVis-180:1);
\draw[current plane,dashed] (180-\angVis:1) arc (180-\angVis:\angVis:1);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The Orange dots on the cyan and green line should be on the red lines, so how to achieve the right coordinates.

I would prefer to use the angles to set the coordinates, as I need them for some other stuff. Thanks for your help.
Attachments
EOS-test2.jpg
EOS-test2.jpg (167.55 KiB) Viewed 6482 times
Last edited by startrucky on Thu Mar 26, 2015 1:32 pm, edited 2 times in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX books
startrucky
Posts: 11
Joined: Mon Aug 18, 2014 2:02 pm

Re: 3D Orbits around Sphere, arc points or orbit coordinates

Post by startrucky »

Does nobody even have a suggestion maybe?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10308
Joined: Mon Mar 10, 2008 9:44 pm

Re: 3D Orbits around Sphere, arc points or orbit coordinates

Post by Stefan Kottwitz »

The complete document looks a bit complex. It's great to see the whole picture and the whole code, however I guess it would be very helpful for troubleshooting if the code would now be reduced to the absolute minimum for checking the position of the point which doesn't match the orbit. I mean, removing all orbits and coordinates which are not related to the problem. The smaller, the better understandable. I tested and searched, but still without success.

Stefan
LaTeX.org admin
startrucky
Posts: 11
Joined: Mon Aug 18, 2014 2:02 pm

Re: 3D Orbits around Sphere, arc points or orbit coordinates

Post by startrucky »

High there,
yeah thanks I tried to simplify it, unfortunately I don't really think it gets easier than this.
startrucky
Posts: 11
Joined: Mon Aug 18, 2014 2:02 pm

3D Orbits around Sphere, arc points or orbit coordinates pos

Post by startrucky »

The Question got answered on http://tex.stackexchange.com/a/235221.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10308
Joined: Mon Mar 10, 2008 9:44 pm

3D Orbits around Sphere, arc points or orbit coordinates pos

Post by Stefan Kottwitz »

The solution was found by TonioElGringo at the link above. He wrote: The problem comes from the following line (in \OrbitPlane definition):

Code: Select all

\tikzset{#1/.style={cm={\cost,\sint*\sinEl,0,\cosEl,(0,0)}}}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The \cost, \sint, \sinEl and \cosEl macros are not expanded before setting the style, so in your code both orbplane and orbplanetwo are set to the same style. You should use the /.estyle key handler, giving you

Code: Select all

\tikzset{#1/.estyle={cm={\cost,\sint*\sinEl,0,\cosEl,(0,0)}}}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
This breaks the \DrawOrbitCircle with recent TikZ versions here:

Code: Select all

\tikzset{current plane/.prefix style={scale=#1}}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
since /.prefix handlers seems to have a bug when used after a /.estyle, to fix it:

Code: Select all

Code, edit and compile here:
\newcommand{\DrawOrbitCircle}[2][3]{
\OrbitPlane{\angEl-8}{#2} % orbit kippen!!!
% angle of "visibility"
\pgfmathsetmacro\angVis{atan(sin(#2)*cos(\angEl)/sin(\angEl))} %
% original
\draw[scale=#1,current plane] (\angVis:1) arc (\angVis:\angVis+180:1); % sichtbarkeit des vor der kugel befindlichen bereichs
\draw[scale=#1,current plane,dashed] (\angVis-180:1) arc (\angVis-180:\angVis:1);
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Stefan

PS: oh, also here you were seconds faster. :-) I transferred the solution for easy reading also to here, with link to Tonio's profile, the link to the answer was already given by you above.
LaTeX.org admin
Post Reply