P5 rotate vs ofRotate with atan2 question

Hi,

i´m about to port a project from P5 to of and all works very well. But i need a pixelation to rotate exactly like in P5 and i stuck in how to do this. Any help is appreciated:

P5: rotate (atan2(hPoster/2-(hPoster/hPixls)*(j), wPoster/2-wPoster/wPixls*(i)) + radians(180));

oF: ofRotate(atan2(hPoster/2-(hPoster/hPixls)*j, wPoster/2-(wPoster/wPixls)*i) * 180);
-- //ofRotate(180, wPoster/wPixls*(i), (hPoster/hPixls)*(j), 0);

But it looks partly different, as you can see in the images.

Anybody any idea how to make this look the same?

Thx,
A.

ofRotate works in degrees while it roate in processing works in radians if i remember correctly

thanks arturo, but i think its not the deg / rad issue, its that atan2 seems to behave bit different. I played around with the vecX, veZ from ofRotate but this didn´t help. P5 does a real 180° rotation, in oF it looks more like a 360° flip, thats my problem…

Looks like this call is mixing radians and degrees. Have you tried something like:

float degrees =  atan2( hPoster/2-(hPoster/hPixls)*j, wPoster/2-(wPoster/wPixls)*i) * RAD_TO_DEG;
ofRotate( degrees + 180);
1 Like

Nick, yeah, exactly that´s it!

Thanks man!

A.