POV-Ray : Newsgroups : povray.advanced-users : Vector to Angle : Re: Vector to Angle Server Time
25 Apr 2024 15:35:56 EDT (-0400)
  Re: Vector to Angle  
From: dick balaska
Date: 29 May 2017 22:58:49
Message: <592cdfe9$1@news.povray.org>
Am 2017-05-29 15:42, also sprach dick balaska:
> I'm trying to master converting a vector to an angle in 3D
Of course I figured it out after finally asking:

// Convert this vector into its angle
#macro VtoA(V)
	#local _V=vnormalize(V);
	#local rZ=degrees(acos(_V.z));
	#local rY=0;
	#if (_V.y != 0)
		#local rY=degrees(atan2(_V.x,_V.y));
	#end
	#debug concat("rY/Z=", str(rY,0,2), ", ", str(rZ,0,2), "\n")
	<-rZ,0,-rY>
#end

-- 
dik


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.