0

Can you please help me find a systematic way of drawing many vectors through the origin in 3D so they resemble a sphere? I think dividing the sphere into 120 vectors in all directions should be enough.

3
\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usetikzlibrary{calc,fadings,decorations.pathreplacing}

\begin{document}

\tdplotsetmaincoords{60}{120}
\begin{tikzpicture}
    [scale=3, tdplot_main_coords, axis/.style={->}, vector/.style={-stealth}]

    %standard tikz coordinate definition using x, y, z coords
    \coordinate (O) at (0,0,0);

    %tikz-3dplot coordinate definition using r, theta, phi coords
    \foreach \a in {0, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260, 280, 300, 320, 340}
        \foreach \b in {0, 20, 40, 60, 80, 100, 120, 140, 160}
            %draw a vector from O to P
            \draw[vector, color=black, opacity=0.4] (O) -- ({cos(\a)*sin(\b)}, {sin(\a)*sin(\b)}, {cos(\b)});   

    %draw axes
    \draw[axis, thick] (-1,0,0) -- (2,0,0) node[anchor=north east]{$y,\beta$};
    \draw[axis, thick] (0,-1,0) -- (0,2,0) node[anchor=north west]{$x, \alpha$};
    \draw[axis, thick] (0,0,-1) -- (0,0,2) node[anchor=south]{$z, \gamma$};


\end{tikzpicture}

\end{document}

I used lots of other peoples' code and lost tracks of them. But this does the trick.

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.