I have a vector (white line), a centre and a radius along each of the semi-major and semi-minor axes of an ellipse (green line). I need to find the point where the white line intersects the green.
I have tried to work it out using Atan2, Sin and Cos but that doesn't quite work (blue line). It works when parallel to an axis but doesn't otherwise, I have a feeling this is because I am trying to perform the calculation on an ellipse where the horizontal and vertical radii are different.
Vector2 delta = (screenPos - canvasCentre).normalized; float angle = Mathf.Atan2(delta.y, delta.x); Vector2 position = canvasCentre + new Vector2( Mathf.Cos(angle) * radius.x, Mathf.Sin(angle) * radius.y); 