For example, suppose a user has a circle equation and an ellipse equation and wants to know the intersection points. Mathematically speaking, this is a pretty simple problem, but I can't figure out how to tell Xcode about the solution to this system.
The problem of intersection of a circle and an ellipse in the general case involves solving the equation of polynomials of the fourth degree. You can break it down to the third degree, but square roots are not enough. Therefore, I would say that this is actually not a "simple simple problem." At the same time, some numerical libraries support algorithms for searching for real or complex roots of a one-dimensional polynomial. Thus, you must eliminate one of your variables (for example, using the resulting elements or Grรถbner bases), and then pass the resulting polynomial. You do not know which libraries will be the most suitable in the world of Objective C. But the question requiring a specific library will be considered off-topic anyway, so use the keywords that I mentioned to find what suits your needs.
I was even curious how to calculate the tangent line of a curve and other similar geometry problems.
The tangent direction is simply orthogonal to the implicit shape gradient. In other words, describe your curve not parametrically as x = f (t) and y = g (t), but instead implicitly, like f (x, y) = 0. In the case of a circle that looks like x 2 + y 2 + ax + on + c = 0. Then we calculate the partial derivatives with respect to x and y. These are 2x + a and 2y + b. So, (2x + a, 2y + b) is perpendicular to the circle, and (2y + b, -2x-a) is tangential. Not sure what you think looks like this.
source share