How can the following function be implemented in various languages?
Calculate the (x,y) point on the circumference of a circle, given input values of:>
(x,y)
Who needs trig when you have complex numbers:
#include #include #define PI 3.14159265358979323846 typedef complex double Point; Point point_on_circle ( double radius, double angle_in_degrees, Point centre ) { return centre + radius * cexp ( PI * I * ( angle_in_degrees / 180.0 ) ); }