直交座標から球面座標へ変換します。
//**********************************************************************************
入力 Pv:直交座標の値
出力
//**********************************************************************************
#macro Spherical_cnv_y(Pv)
#local RR=vlength(Pv); #local Rh=vlength(
#if(Pv.x=0 & Pv.z=0) #local HH=0; #else #local HH=atan2(Pv.z,Pv.x); #end
#if(Rh=0 & Pv.y=0) #local VV=0; #else #local VV=atan2(Pv.y,Rh); #end
< RR,HH,VV >
#end
//**********************************************************************************
atan(Pv.y/Rh)の計算には、atan2(Pv.y,Rh)を使用する。
Pv.y=0 かつ Rh=0 のとき、atan2 はエラーになる。 どちらか一方が0でも正常な値を返す。
Pv.y は、直交座標 Pv=