liveBook · Manning

Inverse

As explained in Geometry for Programmers

An inverse transformation is a mapping that reverses another transformation by recovering each original point from its transformed point.

An inverse transformation undoes a transformation: apply the original mapping to a point, then apply its inverse to recover the starting point. For geometric work, this is how transformed coordinates can be brought back to the original shape. section 4.3.2

Projective transformations make this especially practical. Homogeneous coordinates express translation, rotation, scaling, shear, and their compositions as matrix multiplications. Because a projective point may be represented by scaled coordinate tuples, one transformation has a continuum of equivalent matrices; that freedom can make an inverse transformation cheaper than computing an ordinary inverse matrix. section 4.0 section 4.7

A useful workflow is:

  • Compose the required geometric steps into one transformation matrix, rather than repeatedly transforming every point. section 4.3.2
  • Transform the points of the shape with the composed matrix. section 4.3.2
  • Compute an inverse matrix, or an equivalent projective inverse representation, and apply it to the transformed points to recover their original coordinates. section 4.3.2 section 4.7

Rotating a rectangle and reversing it

A rectangle centered near (1, 1) is translated to the origin, rotated 90 degrees clockwise, and translated back. The three 3×3 matrices are multiplied into one matrix c. In SymPy, c.inv() produces c_inv; multiplying c_inv by each transformed corner restores the four original corners, including (0.75, 0.5) and (1.25, 1.5). section 4.3.2 section 4.3.2

pt1 = c * p1
pt2 = c * p2
pt3 = c * p3
pt4 = c * p4
...
print(c_inv * pt1)
print(c_inv * pt2)
print(c_inv * pt3)
print(c_inv * pt4)

This SymPy listing applies a composed transformation and then its inverse to each rectangle corner, making the recovery check explicit. section 4.3.2

Not every transformation has a usable one-to-one inverse. Biquadratic and polynomial transformations can map different input points to the same output point, so reversing them may be ambiguous rather than a function. section 10.5

How Geometry for Programmers covers it

How deep it goes
Works through matrix-based recovery of rectangle corners and notes faster projective alternatives, without deriving a general inverse algorithm.
Examples
Uses a rectangle rotated about its center and restored with a SymPy inverse matrix.
What it assumes
Introduces inverses through geometric transformations and homogeneous-coordinate matrix representations rather than assuming advanced mathematics.
What you can do after
Apply it via SymPy matrix inversion to restore points after a composed projective transformation.
How it connects
Connects inverse transformations with homogeneous coordinates, projective transformations, matrix multiplication, and transformation composition.

Also explained in

Compare how 2 books explain inverse →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Geometry for Programmers. The section links point to the parts of the book it draws on.