Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Main(string[] args)
- {
- int userx=10;
- int usery=0;
- int userz=10;
- Console.WriteLine("alap X: "+userx+" Y: "+usery+" Z: "+userz);
- int userR=10;
- double calcX;
- double calcY;
- double calcZ;
- double Theta; //Théta
- double Fi; //Fi
- Fi = Math.Acos(userz / userR);
- if (userx == 0)
- {
- Theta = Math.Atan(0);
- }
- else
- {
- Theta = Math.Atan(usery / userx);
- }
- calcX = userR * Math.Sin(Fi) * Math.Cos(Theta);
- if (calcX < 0.001)
- {
- calcX = 0;
- }
- calcY = userR * Math.Sin(Fi) * Math.Sin(Theta);
- if (calcY < 0.001)
- {
- calcY = 0;
- }
- calcZ = userR * Math.Cos(Fi);
- if (calcZ < 0.001)
- {
- calcZ = 0;
- }
- Console.WriteLine("kalkulált x: " + calcX + " y: " + calcY + " z: " + calcZ);
- Console.WriteLine("alpha: " + Theta * 180 / Math.PI + " Beta: " + Fi * 180 / Math.PI);
- Console.ReadKey();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement