i need your help with this code i have here:
Console.WriteLine();
Console.WriteLine("Enter first X value: ");
float point1X = float.Parse(Console.ReadLine());
Console.WriteLine("Enter first Y value: ");
float point1Y = float.Parse(Console.ReadLine());
Console.WriteLine("Enter second X value: ");
float point2X = float.Parse(Console.ReadLine());
Console.WriteLine("Enter second Y value: ");
float point2Y = float.Parse(Console.ReadLine());
Console.WriteLine();
double deltaX = point2X - point1X;
double deltaY = point2Y - point1Y;
double distance = Math.Sqrt(Math.Pow(deltaX, 2) + Math.Pow(deltaY,2)) ;
double angleX = Math.Atan2(point1X,point1Y);
Console.WriteLine("DeltaX value is: " + deltaX);
Console.WriteLine("DeltaY value is: " + deltaY);
Console.WriteLine("The distance is: " + distance);
Console.WriteLine("The angle is: " + angle + "°");
}
}
Basically I need help with that line that is separated from the rest. I want to calculate the angle between 2 points and print it on degrees. I know it's a very simple code, but I have to deliver it for a qualified job.
Note 1: I have to use Atan2 () obligatorialy.
Note 2: I have to calculate the angle between the vector of the 2 points.
Note 3: Here's some crappy drawing of what i need
https://i.stack.imgur.com/31tvB.png
Note 4: The user puts 2 coordinates, one for the first point and one for the second point. What i need to calculate is the angle between the vectors of the 2 points.