Graphics, Figures & Tables3d sphere old code

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

3d sphere old code

Post by startrucky »

Hi there,
as recommended I moved here to make a new post rather than adding to an 6 year old one.
This one: http://latex-community.org/forum/viewto ... 1&start=10
by the way, sorry I don't know how to link properly.

This is a crosspost to http://tex.stackexchange.com/questions/ ... oordinates

I got the problem that the code I modified is kinda old so... well I show you:
I want this:
What i want
What i want
want.jpg (118.66 KiB) Viewed 6349 times
which works in writeLatex, the problem is it uses estyle which leads to removed latitude and longitude circles using texniccenter and miktex:
without longitude circles
without longitude circles
screwed.jpg (74.43 KiB) Viewed 6349 times
Replacing estyle by style, makes the lines appear again, but confused all the nodes:
After change of estyle to style
After change of estyle to style
screwed2.jpg (105.22 KiB) Viewed 6349 times
As far as I now this is a problem of the old code I am using, I would really appreciate some suggestions or somebody who knows the changes of tikz from i guess 1.5 to 3.0+

If somebody could tell me how to place my points again it should work.

Thanks and kind regards
sty

Code: Select all

Code, edit and compile here:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,fadings,decorations.pathreplacing}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{5pt}
\pagestyle{empty}
%% 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\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
Last edited by startrucky on Mon Aug 18, 2014 8:52 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

startrucky
Posts: 11
Joined: Mon Aug 18, 2014 2:02 pm

3d sphere old code

Post by startrucky »

Here is a bloody fix up, by setting all points manually.
For the actual problem there seems to be a ticket http://sourceforge.net/p/pgf/bugs/306/

Code: Select all

Code, edit and compile here:
\documentclass{article}
%%\usepackage[nomain,nonumberlist,acronym,section,description]{glossaries}
%%\newglossary[alg]{acronymlist}{acr}{acn}{Abkverzeichnis}
%%\makeglossaries
%%
%%\newacronym[description=Part of Speech test extra]{POS}{POS}{Part Of Speech}
%%
%%\begin{document}
%%
%%Test \gls{POS} and ?
%%\glsaddall
%%
%%\printglossaries
%%\input{globe}
%% ========== glossaries test end
%
%\documentclass{article}
%\usepackage{pgfplots}
% added tikz-3dplots, 3D NOT CHANGING ANYTHING SO FAR
\usepackage{tikz, tikz-3dplot}
\usetikzlibrary{3D,calc,fadings,decorations.pathreplacing}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{5pt}
\pagestyle{empty}
%% 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}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Re: 3d sphere old code

Post by cgnieder »

This post looks like a crosspost to TeX.sx: http://tex.stackexchange.com/questions/ ... oordinates

It's always nice to give a link in such cases!

Regards
site moderator & package author
startrucky
Posts: 11
Joined: Mon Aug 18, 2014 2:02 pm

Re: 3d sphere old code

Post by startrucky »

Yeah forgot that sorry, added it above as well just to make sure.
Post Reply