# Find points that are mapped to the original grid with image rotation by a non multiple of 90 degrees

I would like to find the point that are "not interpolated" when I rotate an image with e.g. Matlab's imrotate() by an angle which require interpolation e.g. 6 degrees, i.e. not a multiple of 90 degrees.

In other words, I would like to perform rotation by an arbitrary angle but WITHOUT any interpolation. (i.e., I expect to find "holes'' where the fractional coordinates are computed by the multiplication with the rotation matrix.)

The idea I had was to use the points which would be mapped to an integer coordinate after rotation by the rotation matrix [cos(t) -sin(t);sin(t) cos(t)] but that does not seem to work since there is always some approximation error in a numerical analysis oriented language like Matlab, but in computers in general of course.

Any ideas/functions?

• So, in general, there isn't a single integer pixel that's mapped to an integer pixel position. You need to restrict yourself to rotations of non-algebraic (especially: non-rational, non-integer) radians. (that's not a "bad" restriction in practice, since you're probably less interested in rotating something by 0.01 radians and more in things like "two sixhundredths" of a circle.) (Lindemann-Weierstraß) – Marcus Müller Nov 11 '20 at 21:58
• You're really looking for solutions to $q = \begin{pmatrix} \cos \theta & -\sin \theta \\ \sin \theta & \cos \theta \\ \end{pmatrix}p$, with $p,q\in\mathbb Q$. That's a hard problem, and I would not be surprised if there were no solutions that you can give without saying "$\arccos / \arcsin$ of this and that rational number", aside from $\theta = n\cdot\frac\pi2$ at all. – Marcus Müller Nov 11 '20 at 22:00
• Hum thanks, this is quite interesting. What do you think of if I just round the results of the matrix multiplication i.e. if I get voords [1.1 2.5] i would assign to coords[1 2] . I already did that and I get some holes but are they sort of the "correct " holes?^^ So it seems I get these hole because some pixels get rounded to the same coordinates. – Machupicchu Nov 11 '20 at 22:29
• I don't know what you want to achieve with all this, so I can't answer whether that sounds like a good idea. – Marcus Müller Nov 12 '20 at 9:38