直交座標から球面座標への変換を行います。
//**********************************************************************************
入力 Pv:直交座標における曲面の座標値
出力
//**********************************************************************************
#macro Spherical_cnv_z(Pv)
#local RR=vlength(Pv); #local Rh=vlength(
#if(Pv.x=0 & Pv.y=0) #local HH=0; #else #local HH=atan2(Pv.y,Pv.x); #end
#if(Rh=0 & Pv.z=0) #local VV=0; #else #local VV=atan2(Pv.z,Rh); #end
< RR,HH,VV >
#end
//**********************************************************************************
atan2 は、tan の逆関数で、tanθ=Pv.z/Rh の θ の角の値を返します。 角の単位は、ラジアンです。
Pv.z は、曲面の座標値であるPvのz座標の値です。