# Dual origins in rotate

## Dual origins in rotate

Hi
I see that ippiRotateCentre allows me to set a rotation centre for the source.
I assume that this rotation centre point will will be mapped to the 0,0 point on the destination.

But I want to place the result at an arbitary point on the destination, and as far as I can tell there is no way of combining the two origins "in to one" so as to use the function? Am I right, is there an alternative?Or is this an embarrissingconsequence of coming back from a two week holiday and not yet having re-engaged the 2d equation solving part of my brain? [If so, pls advise required algebra.]

Thanks

Dave Turnbull

3 posts / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.

Hi,

ippiRotateCenter uses a rotation centre for the source image and mapped source center to the point in destination image with the same coordinates. If you want to place the result at an arbitary point on the destination you should use ippiRotate function with required xShift and yShift parameters for example you can use the follwing code

xCenterSrc = ...;
yCenterSrc = ...;
angle = ...;
xCenterDst = ...;
yCenterDst = ...;

ippiGetRotateShift(xCenterSrc, yCenterSrc, angle, &xShift, &yShift);

xShift += xCenterDst - xCenterSrc;
yShift += yCenterDst - yCenterSrc;

ippiRotate(..., angle, xShift, yShift, interpolate);

Regards,

Hi,

there is answers from our expert:

1) yes, if You mean matrix of kind

a00 a01 a02
a10 a11 a12
0 0 1

2) yes, ippiWarpAffine is quick as Rotate (and in current implementation ippiRotate uses it)

3) there is ippiWarpAffineBack function in IPP which perform tramsformation with inverse matrix

4) ippiGetAffineTransform, ippiGetAffineTransform, ippiWarpAffine and ippiWarpAffineBack deal with matrix

X' = coeffs[0][0] * X + coeffs[0][1] * Y + coeffs[0][2]
Y' = coeffs[1][0] * X + coeffs[1][1] * Y + coeffs[1][2]

Regards,