Function to map point on different coordinates?

409 Views Asked by At

There is a problem to find an equation or function to solve it. Lets say we have a point in coordinates system (shown left in image attached) like this 0,0 on top-left; 1,0 on top right; 0,1 on bottom-left and 1,1 on bottom right. On this plane we can have a point on anywhere let's suppose it is near bottom right at 0.8, 0.8.

Problem is how to find the value at exact 0.8, 0.8 position of above coordinates system in the other coordinates system (shown right in image attached) in which 0,1 is on top-left; 0,0 on top right; 1,1 on bottom-left and 1,0 on bottom right.

The image attached also shows the expected values of point in same position in other plane should be for 0.25, 0.25 is 0.25, 0.75; same way 0.75,0.75 should be 0.75, 0.25; and 0.25, 0.75 as 0.75, 0.75 so on.

The pattern is not static. I am new in it, please help. Thanks.

enter image description here

1

There are 1 best solutions below

0
On BEST ANSWER

The desired transformation is a clockwise quarter turn about $(0.5, 0.5)$. This can be achieved by composing together three simpler transformations:

  • Translating the pivot to the origin: $(x, y) \mapsto (x - 0.5, y - 0.5)$.
  • Rotating by a clockwise quarter turn about the origin: $(x, y) \mapsto (y, -x)$.
  • Translating the origin back to the pivot: $(x, y) \mapsto (x + 0.5, y + 0.5)$.

Together, we get: $$ (x, y) \mapsto (y, 1 - x) $$ Sure enough, this rule is consistent with your given examples.