I have circle with diameter 256px, middle point is on xy[128,128]. I have first point on circle, for example X=0,Y=128. Coordinates origin is in left top corner. Line between first point and middle, together with angle on this line (starting from middle) creates triangle which intersects circle in third point. How can I calculate this point?
Input variables are :
expected output is x1,y1
Formulas for rotation of initial point around center point by angle:
x1 = middle.x + (x - middle.x) * cos(angle) - (y - middle.y) * sin(angle)
y1 = middle.y + (x - middle.x) * sin(angle) + (y - middle.y) * cos(angle)
(this is affine transform - combination of translation middle to origin, rotation about origin and backward translation)
Don't forget to make cos and sin argument in radians rather than degrees like this:
cos(angle * M_PI / 180)