%%%% %%%% y and z functions, i.e. the curve %% sphere % \pgfkeys{/tikz/.cd, sphereRadius/.store in=\sphRadius, sphereRadius=1 } \tikzmath{% function ySphere(\tvar) {% \tvar in [-90, 90] return \sphRadius*sin(\tvar); }; function zSphere(\tvar) {% return \sphRadius*cos(\tvar); }; } %% cone % \pgfkeys{/tikz/.cd, baseRadius/.store in=\baseRadius, baseRadius=1 } \pgfkeys{/tikz/.cd, topRadius/.store in=\topRadius, topRadius=1 } \pgfkeys{/tikz/.cd, height/.store in=\height, height=3 } \tikzmath{% function yCone(\tvar) {% return \tvar*\height; }; function zCone(\tvar) {% return \baseRadius +\tvar*(\topRadius -\baseRadius); }; } %% hyperboloid1 and 2 % \pgfkeys{/tikz/.cd, z half axis/.store in=\zHalfAxis, z half axis=1 } \pgfkeys{/tikz/.cd, y half axis/.store in=\yHalfAxis, y half axis=1 } \tikzmath{% function yHyperboloid1(\tvar) {% \tvar in [-y_max, y_max] return \tvar; }; function zHyperboloid1(\tvar) {% return \zHalfAxis*pow(1 +pow(\tvar/\yHalfAxis, 2), .5); }; } \tikzmath{% function yHyperboloid2(\tvar) {% return \yHalfAxis*pow(1 +pow(\tvar/\zHalfAxis, 2), .5); }; function zHyperboloid2(\tvar) {% \tvar in [0, z_max] return \tvar; }; } % %% ellipsoid \tikzmath{% function yEllipsoid(\tvar) {% \tvar in [-90, 90] return \yHalfAxis*sin(\tvar); }; function zEllipsoid(\tvar) {% return \zHalfAxis*cos(\tvar); }; } % %% torus \pgfkeys{/tikz/.cd, tMinorRadius/.store in=\tMinorRadius, tMinorRadius=1.6 } \pgfkeys{/tikz/.cd, tMajorRadius/.store in=\tMajorRadius, tMajorRadius=3 } \tikzmath{% function yTorus(\tvar) {% \tvar in [0, 1] return \tMinorRadius*sin(\tvar); }; function zTorus(\tvar) {% return \tMajorRadius +\tMinorRadius*cos(\tvar); }; } % %%%% Show coordinates pic object % %% It needs layers (above and under
). % \tikzset{% % pics/showCoordinates/.style n args={4}{% % % #1 = color % % #2 = length % % #3 = S layer (foreground) for the arrow % % #4 = U layer (background) for the arrow (behind main layer) % code={% % \draw[#1, thin] (0, 0) circle (.5); % \tikzmath{% % real \aConstant; % \aConstant = #2; % } % \begin{pgfonlayer}{main} % \draw[#1, ultra thick] (0, 0, 0) -- (\aConstant, 0, 0) % node[pos=1.25, scale=.7, text=K] {$x$}; % \draw[#1, ultra thick] (0, 0, 0) -- (0, \aConstant, 0) % node[pos=1.25, scale=.7] {$y$}; % \draw[#1, ultra thick] (0, 0, 0) -- (0, 0, \aConstant) % node[pos=1.25, scale=.7] {$z$}; % \end{pgfonlayer} % % % \begin{scope}[baseRadius=\aConstant/12, topRadius=0, % height=\aConstant/10, % rotating surface={yCurve=yCone, zCurve=zCone, % meridians=36, parallels=2, t_ini=0, t_end=1, % rAxis={90, 90}}] % \draw (\aConstant, 0, 0) pic[#1] {rSurface SU={#3}{#4}}; % \end{scope} % \begin{scope}[baseRadius=\aConstant/12, topRadius=0, % height=\aConstant/10, % rotating surface={yCurve=yCone, zCurve=zCone, % meridians=36, parallels=2, t_ini=0, t_end=1, % rAxis={0, 0}}] % \draw (0, \aConstant, 0) pic[#1] {rSurface SU={#3}{#4}}; % \end{scope} % \begin{scope}[baseRadius=\aConstant/12, topRadius=0, % height=\aConstant/10, % rotating surface={yCurve=yCone, zCurve=zCone, % meridians=36, parallels=2, t_ini=0, t_end=1, % rAxis={0, 90}}] % \draw (0, 0, \aConstant) pic[#1] {rSurface SU={#3}{#4}}; % \end{scope} % } % } % } % \newcommand{\freeShowCoordinates}[6][]{% % % #1 = color (optional argument) % % #2 = length % % #3 = viewer's longitude % % #4 = viewer's latitude % % #5 = sun's longitude % % #6 = sun's latitude % \ifthenelse{\equal{#1}{}}{\colorlet{tmpRGB}{O}}{\colorlet{tmpRGB}{#1}} % \tikzexternalenable % \begin{tikzpicture}[view={#3}{#4}, sun={#5}{#6}{.5}] % \pgfdeclarelayer{-1} % \pgfdeclarelayer{1} % \pgfsetlayers{-1, main, 1} % \path (0, 0) pic {showCoordinates={tmpRGB}{#2}{1}{-1}}; % \end{tikzpicture} % \tikzexternaldisable % }