// 点が X 軸となす角度θを求める float theta = 0.0; if ( x == 0.0 ) { if ( y > 0 ) { theta = PI; } else { theta = PI * 2.0; } } if ( x > 0.0 ) { theta = atan ( y / x ) + PI / 2.0; } if ( x < 0 ) { theta = atan( y / x ) + PI * 1.5; }