Sunday, April 14, 2013

Introduction to Affine Maps

Affine Maps

An affine transformation of R[n] is a function t:R[n]->R[n] of the form t(x)+Ax+b where A is an n x n invertible matrix and b is in R[n].  Our current focus is on R[2] of two dimensions but all the important properties coming up hold for all dimensions.

So what makes affine transformations so special?  Affine transformations have 3 nice properties:

1. t maps straight lines to straight lines
2. t maps parallel straight lines to parallel straight lines
3. t preserves ratios of lengths along straight lines

Let's say you are interested in scanning a physical picture into your computer.  Your picture is the input, the scanner with it's configuration is the function, and the resulting digital image is your output.

Second example would be opening a digital image in photo editing software and then scaling it down and/or rotating it.

In both examples the image looks the same just smaller or larger and in a different position, with affine maps the straight lines will always be straight but the angles can change and distort the image.  A single affine map instruction covers the movement/change of an individual image.

How do I write an affine map instruction?
Without getting into how these equations are developed let's focus on how to write the set of instructions.  The standard geometric equation is

affine(r,s,θ,φ,e,f) -> (x*r*cos(θ)-y*s*sin(φ)+e, x*r*sin(θ)+y*s*cos(φ)+f)
  • r - controls the x scale
  • s - controls the y scale
  • θ - controls the left angle
  • φ - controls the right angle
  • e - controls the x shift
  • f - controls the y shift
Each value has a specific control on the starting image.  Your starting image can be a set of points that define an image or even a single point.  You send these points through the function defined by the affine map and then view the result.  Let's take a look at examples of desired movements and how to represent that in affine geometric notation.

Affine Structure  
The set of all affine maps is a group under function composition. So affine mappings are closed, there exists an identity affine map and an inverse map that undoes your changes.

Note: The above image uses Mr. Face, a 1x1 square with left open eye and right closed.  I was introduced to Mr. Face along with dynamical systems by Ken Monks at the University of Scranton during my undergraduate years.

1 comment:

  1. To further sweeten the wins, gamers 퍼스트카지노 will get an opportunity to qualify for even larger multipliers when they land on the Sugar Bomb section of the wheel. More and more casinos websites are accepting cryptocurrencies nowadays, too, and it’s not uncommon to see Bitcoin, Litecoin, Ethereum, Doge, and different altcoins within the menu. The quickest customer assist is available proper right here at Red Dog.