Use Complex Analysis for Finding Reflection of a Point in a Line

150 Views Asked by At

In the question Point reflection over a line complex analysis was used. Can anyone tell me if this method is superior to the standard method (find a perpendicular from the point to the line, find a point on the other side that is equidistant). I have heard that using complex analysis can save precision in certain numerical derivative computations. (If someone can point me to the original text book where this method was discussed, that would be helpful too.)

1

There are 1 best solutions below

4
On

I would be very surprised if using complex numbers has any impact on the numerical precision of computations like this. Complex analysis may be helpful in deriving formulae for reflection (and for rotation, too). But, in the end, you get formulae for the coordinates of the reflected point, and those formulae will be very similar regardless of how they are derived. The key to numerical precision is careful organization of the steps in the computation (avoiding subtractive cancellation, and so on). I don't see any reason why formulae derived from complex analysis would be superior in this respect.

Despite what one of the comments says, I don't see any use of complex analysis in the answers you cited. The formulae were derived by simple vector methods, which seems like the simplest approach, to me. Incidentally, the code in the original question is not very well written, in my opinion.

Reflection isn't an unstable operation (as far as I can see), which might explain why sophisticated methods have not been developed. Just do the obvious vector calculations, being careful to avoid subtractive cancellation. If that's not good enough, use extended precision arithmetic: C++ has a long double data type, C# has decimal, etc.