Edit and compile if you like:
\documentclass{article}\usepackage{tikz}\usepackage{tikz-3dplot}\usetikzlibrary{math}\usepackage[active,tightpage]{preview}\PreviewEnvironment{tikzpicture}\setlength\PreviewBorder{0.125pt}%% File name: directional-angles.tex% Description:% The directional angles of a vector are geometrically represented.%% Date of creation: July, 25th, 2021.% Date of last modification: October, 9th, 2022.% Author: Efra�n Soto Apolinar.% https://www.aprendematematicas.org.mx/author/efrain-soto-apolinar/instructing-courses/% Source: page 11 of the% Glosario Ilustrado de Matem\'aticas Escolares.% https://tinyurl.com/5udm2ufy%% Terms of use:% According to TikZ.net% https://creativecommons.org/licenses/by-nc-sa/4.0/% Your commitment to the terms of use is greatly appreciated.%\begin{document}\tdplotsetmaincoords{80}{120}%\begin{tikzpicture}[tdplot_main_coords,scale=0.75]% Indicate the components of the vector in rectangular coordinates\pgfmathsetmacro{\ux}{4}\pgfmathsetmacro{\uy}{4}\pgfmathsetmacro{\uz}{3}% Length of each axis\pgfmathsetmacro{\ejex}{\ux+0.5}\pgfmathsetmacro{\ejey}{\uy+0.5}\pgfmathsetmacro{\ejez}{\uz+0.5}\pgfmathsetmacro{\umag}{sqrt(\ux*\ux+\uy*\uy+\uz*\uz)} % Magnitude of vector $\vec{u}$% Compute the angle $\theta$\pgfmathsetmacro{\angthetax}{pi*atan(\uy/\ux)/180}\pgfmathsetmacro{\angthetay}{pi*atan(\ux/\uz)/180}
Click to download: directional-angles.tex • directional-angles.pdf
Open in Overleaf: directional-angles.tex
See more on the author page of Efraín Soto Apolinar.