Where is this transform matrix and the coordinate ...
# magic
c
Where is this transform matrix and the coordinate calculation from http://opencircuitdesign.com/magic/manpages/mag_manpage.html :
Copy code
The transform line gives the geometric transform from coordinates of the child filename into coordinates of the cell being read. The six integers a, b, c, d, e, and f are part of the following transformation matrix, which is used to postmultiply all coordinates in the child filename whenever their coordinates in the parent are required:

a

d

0

b

e

0

c

f

1
defined in a way that the coordinate computation becomes understandable?
m
@Christoph Maier very good question. The display on the web page is misleading. It’s been awhile but I think this explanation is close to being accurate. The transformation matrix should be
Copy code
a b c
d e f
0 0 1
This is the product of the translation matrix (Tx is the x offset and Ty is the y offset)
Copy code
1 0 Tx
0 1 Ty
0 0 1
the rotation matrix (θ is 0, 90, 180, or 270)
Copy code
cosθ sinθ 0
-sinθ cosθ 0
  0    0   1
and the reflection matrix when mirrored about the x-axis
Copy code
1  0 0
0 -1 0
0  0 1
or the y-axis
Copy code
-1 0 0
 0 1 0
 0 0 1
So if we let Mx be 1 normally and -1 when mirrored about the x-axis, let My be 1 normally and -1 when mirrored about the y-axis, we can use this reflection matrix
Copy code
My 0 0
0 Mx 0
0  0 1
and assume the transformations are applied in the translation-rotation-reflection order (the order is relevant) and ignore any scaling (which would be another matrix) The combined matrix variables would be
Copy code
a = cosθ・My
b = sinθ・Mx
c = Tx
d = -sinθ・My
e = cosθ・Mx
f = Ty
This matrix is cross multiplied by a vertical matrix of the coordinates
Copy code
x
y
1
With the transformed coordinate being
Copy code
x' = cosθ・My・x + sinθ・Mx・y + Tx
y' = -sinθ・My・x + cosθ・Mx・y + Ty
and the third value (always 1) is ignored.
💡 1
c
@Mitch Bailey, thanks! After dumping this into my commercial Brain Extension, this actually starts to make sense. Follow-up remark: Your explanation is already way better than the published original, but compared to just writing down the equation in a readable format, and maybe one example with numbers, it's still a bit chatty. That said, good Job x:y
😄 1