Inverse 2D rotation with negative parameters

In summary: Is there a better way to do this?In summary, for a point x,y,p: x',y' = transform(x,y,p) if x,y = transform(x',y',-p)
  • #1
atrus_ovis
101
0

Homework Statement


Say we have a 2D rigid body transform, with parameters [itex]p = [ p_1,p_2,p_3] [/itex] for rotation, x translation and y translation respectively.
I'm using the transform to .. transform an image.

Is there a way to have:
For a point x , y : x',y' = transform(x,y,p) <=> x,y = transform(x',y',-p) , meaning trasforming the transformed point with negative parameters of the initial transformation, gives us the initial point.
Expanding to the image, , i'd want for an image I:
I' = transform(I,p) <=> I = transform(I',-p)

This works simply for transforms that include only translations, but not for rotations.

The rotation is done by rotating the points by the center of ther image.
So by using a 2D rotation matrix with homogenous coordinates to include translation , i have to ,prior to rotation , translate the image by -cx,-cy where cx,cy are the coordinates of the image center , rotate , and then applying the translation.
By this way though , i'd have to know all prior transformations done to the image to know the (now changed) "location" of the image center.

So in short:
I have an image I', transformed by coordinates p.I want a transformation method to yield I when transforming I' with parameters -p.

Any ideas for this to work? Is it even possible?
 
Physics news on Phys.org
  • #2
I take it that p2 and p3 are the x and y translations but what is p1? The angle through which the figure rotated? But rotated about what point? The center? One corner?

Yes, translate the center of rotation to the origin, perform the rotation, then translate back again.

That is, taking [itex](x_0, y_0)[/itex] as the center of rotation, you want to go through a list of points defining the figure, each being (x, y), translate to [itex](x- x_0, y- y_0)[/itex], then rotate through angle [itex]\theta[/itex], using, perhaps, the matrix
[tex]\begin{bmatrix}cos(\theta) & -sin(\theta) \\ sin(\theta) & cos(\theta)\end{bmatrix}[/tex]
then translate back, [itex](x+ x_0, y+ y_0)[/itex].
 
  • #3
As i said, i rotate around the image center.
p1 is the rotation angle,p2 and p3 the x ,y translations respectively.

I am doing what you describe , but the problem is the following:
Say i have an image I', its center located at cx,cy, and it's transformed by p1,p2,p3.
(These parameters are unknown to me).
But by that transformation, the new image center ( that corresponds visually and logically to the initial image center) is now at cx + p2 , cy + p3.

If i use the same routine to apply a new transformation , i will rotate around cx,cy which is not the current image centre, but the initial one, so i won't get the initial image with parameters -p1 -p2 -p3.

A possible solution, is that i could have 2 routines, one for the "forward" transform that behaves the way you described, and one for the "backwards" transform, that firstly translates by -p2 -p3, and then applies the transformation. In that way, the image center will firstly get restored to its proper position and the rotation will be done "correctly".

But having two routines is undesirable.
 

FAQ: Inverse 2D rotation with negative parameters

What is inverse 2D rotation with negative parameters?

Inverse 2D rotation with negative parameters is a mathematical concept used to reverse the effects of a rotation on a 2-dimensional object. It involves using negative values for the rotation angle and direction to undo the original rotation.

Why would someone need to use inverse 2D rotation with negative parameters?

Inverse 2D rotation with negative parameters is commonly used in computer graphics and animation to manipulate the orientation of objects and achieve specific visual effects. It can also be useful in solving geometric problems and analyzing data in 2D space.

How does inverse 2D rotation with negative parameters differ from regular 2D rotation?

The main difference is in the direction of rotation. In regular 2D rotation, a positive rotation angle will rotate an object in a counterclockwise direction, while a negative rotation angle will rotate it in a clockwise direction. In inverse 2D rotation with negative parameters, the direction of rotation is reversed, so a positive angle will rotate the object clockwise and a negative angle will rotate it counterclockwise.

Can inverse 2D rotation with negative parameters be used with any rotation angle?

Yes, inverse 2D rotation with negative parameters can be used with any rotation angle, as long as it is specified in the correct units (usually degrees or radians). However, it is important to note that using very large or small rotation angles may result in distorted or unexpected results.

Are there any limitations or drawbacks to using inverse 2D rotation with negative parameters?

One limitation is that using inverse 2D rotation with negative parameters on an object multiple times may not always result in the original orientation. This is because the rotation angle is not always evenly divisible by 360 degrees, leading to rounding errors. Additionally, using very small or large rotation angles can result in loss of precision and accuracy.

Back
Top