Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Circle2DGI( float x, float y, out float distance, out float angle ) {
- float inverseDistance;
- distance = ( float )Math.Sqrt( x * x + y * y );
- inverseDistance = 1.0f / distance;
- x *= inverseDistance;
- y *= inverseDistance;
- if( x >= 0 ) {
- angle = ( float )Math.Acos( y ) * 180.0f / ( float )Math.PI
- } else {
- angle = 180.0f + ( float )Math.Acos( -y ) * 180.0f / ( float )Math.PI;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment