dmf9000

01-23-2004, 02:49 PM

Hello people, I need help to get an algoritm which can to calculate the scale, to scale an image,this algoritm must have a progressive behavior.

I have four points( it's the image corners) and I want to scale the image without change the center. I put above a piece of code. I'm doing this in loop,

passing a point of every time.The big problem that I have it is in scale calculation . Maybe with a logarithm itīs possible to do it,but I don't know how to do.And after the scaling I have to had the new image coordinates.

If someone can help me, I will be grateful.

thanks.

bool mainScaleOverlay (double scale,const PointR2& centerOrig,const PointR2& pointOrig,PointR2& pointNew)

{

pointNew.x = (pointOrig.x - centerOrig.x) * scale + centerOrig.x;

pointNew.y = (pointOrig.y - centerOrig.y) * scale + centerOrig.y;

return true;

}

I have four points( it's the image corners) and I want to scale the image without change the center. I put above a piece of code. I'm doing this in loop,

passing a point of every time.The big problem that I have it is in scale calculation . Maybe with a logarithm itīs possible to do it,but I don't know how to do.And after the scaling I have to had the new image coordinates.

If someone can help me, I will be grateful.

thanks.

bool mainScaleOverlay (double scale,const PointR2& centerOrig,const PointR2& pointOrig,PointR2& pointNew)

{

pointNew.x = (pointOrig.x - centerOrig.x) * scale + centerOrig.x;

pointNew.y = (pointOrig.y - centerOrig.y) * scale + centerOrig.y;

return true;

}