Thanks for your replies. The use of dot function, does not solve my problem. By the way the dot function has othe uses than
calculate the cos of the angle between two normalized vectors.
Dot([x,y,z],[u,v,w]) is calculated as [x*u+y*v+z*w].
Thanks Dave I will try atan(z/x).
The function I'm going to build is:
u = PI/N
w = mod(v,2u)
f = length*cos(u)/cos(w-u)
EDIT: The last line should read length*cos(w-u)/cos(u)