mouse drawing on rotating image
Aug 14 2017 | 4:21 pm
Im new to jitter but I have some experience working with max. Im trying to make a patch where I can draw on a rotating window using the jit.lcd & jit.rota objects. The plan is to use this in a max4live device as part of a rotating sequencer using colors drawn with the mouse.
Problem is that my drawing gets offset by jit.rota as I draw, where I would like the coordinates of my drawing to happen where the mouse is located while the image spins. I understand why this happens and I can see a possible solution where I adjust the drawing coordinates by taking the current rotation theta (a term that I don´t fully understand) into account.
The jit.rota object provide the following formula: output_x(j, i) = (cosscale_x*cos((theta*thetascalecos_x)+thetaoffsetcos_x)/zoom_x)*(j-(offset_x+anchor_x)) - (sinscale_x*sin((theta*thetascalesin_x)+thetaoffsetsin_x))/zoom_x)*(i-(offset_y+anchor_y))) + anchor_x
I guess that someone that knows a thing or two about geometry and rocket science would be able to understand how to use this in order to calculate the offset where the mouse drawing should occur. Maybe there is an even simpler way?
Here is a small patch that I believe will illustrate the issue Im having, Im very thankful for any help on how to proceed!