# [GRASS5] Affine Transformations ... Some questions

Eric G . Miller egm2 at jps.net
Sun Dec 10 23:25:23 EST 2000

```Hope someone can clarify a few things for me.

Given affine parameters:
A, B, C, D, E, F

for the equation(s):
x' = A(x) + B(y) + C        or        |x'| = |C| + |A D| . |x|
y' = D(x) + E(y) + F                  |y'|   |F|   |B E|   |y|

where "x" and "y" are the original coordinates (e.g. row/col
numbers), and "x'" and "y'" are resulting coordinates.

Q.) How do I determine the resulting ew_res/ns_res and rows/cols terms

A.) I've poked around the imagery library, and it seems to keep the
number of rows/cols the same, but adjust the cell resolution by
doing:

window->ns_res = (window->north - window->south) / rows ;
window->ew_res = (window->east  - window->west) / cols  ;

But somehow that doesn't seem right.  Almost invariably, you'll end up
with a resolution less than (bigger number) than specified for the "A"
and "E" parameters.  Maybe this *is* the correct approach???

So if I have an image with width/height, after finding the four corner
coordinates, I determine the resolutions as above?  Then rows = width
and cols = height always.

This would differ from my understanding that the "A" and "E" terms
represented the ew_res and ns_res terms, respectively, for the resulting
raster.  I suppose it's okay, 'cause setting ew_res = "A" and
ns_res = "E" seemed to have more error about the rows/cols counts not
jibing with the north/south and east/west boundaries.  And yes, I'm
calculating for the outside corners and not the centers of the four
corner cells.

Hope this made sense to someone.

P.S.  I'm trying to rewrite r.in.tiff to handle TIFF World Files
correctly/completely (r.in.gdal probably already does this, but it's
also for my edification).

Knew I should've completed that linear algebra class 8^}

--
Eric G. Miller <egm2 at jps.net>

----------------------------------------
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo at geog.uni-hannover.de with
subject 'unsubscribe grass5'

```