Affine Transform Illustrations

62 views
Skip to first unread message

luser- -droog

unread,
Sep 1, 2015, 10:43:00 PM9/1/15
to
I remember something like this from Newmann and Sproull.
So I made these for my write-up at
http://computergraphics.stackexchange.com/questions/391/what-are-affine-transformations

josh@cadabra ~/affine
$ for i in `ls -1 *.ps` ; do echo ====== $i ============ ; cat $i ; echo ============ ; done
====== ident.ps ============
%!
/axis {
currentpoint 4 {
2 copy moveto
50 0 lineto
90 rotate
} repeat pop pop
} def
/shape {
20 0 moveto
30 20 lineto
40 0 lineto
closepath
} def

100 100 translate

gsave
currentlinewidth 1.5 mul setlinewidth
1 0 0 setrgbcolor
0 0 moveto axis shape stroke
grestore

0 0 moveto axis shape stroke

showpage
============
====== rotate.ps ============
%!
/axis {
currentpoint 4 {
2 copy moveto
50 0 lineto
90 rotate
} repeat pop pop
} def
/shape {
20 0 moveto
30 20 lineto
40 0 lineto
closepath
} def

100 100 translate

gsave
12 rotate
currentlinewidth 1.5 mul setlinewidth
1 0 0 setrgbcolor
0 0 moveto axis shape stroke
grestore

0 0 moveto axis shape stroke

showpage
============
====== scale.ps ============
%!
/axis {
currentpoint 4 {
2 copy moveto
50 0 lineto
90 rotate
} repeat pop pop
} def
/shape {
20 0 moveto
30 20 lineto
40 0 lineto
closepath
} def

100 100 translate

gsave
1.5 1.5 scale
currentlinewidth 1.5 mul setlinewidth
1 0 0 setrgbcolor
0 0 moveto axis shape stroke
grestore

0 0 moveto axis shape stroke

showpage
============
====== skewx.ps ============
%!
/axis {
currentpoint 4 {
2 copy moveto
50 0 lineto
90 rotate
} repeat pop pop
} def
/shape {
20 0 moveto
30 20 lineto
40 0 lineto
closepath
} def

100 100 translate

gsave
[1 .7 0 1 0 0] concat
currentlinewidth 1.5 mul setlinewidth
1 0 0 setrgbcolor
0 0 moveto axis shape stroke
grestore

0 0 moveto axis shape stroke

showpage
============
====== skewy.ps ============
%!
/axis {
currentpoint 4 {
2 copy moveto
50 0 lineto
90 rotate
} repeat pop pop
} def
/shape {
20 0 moveto
30 20 lineto
40 0 lineto
closepath
} def

100 100 translate

gsave
[1 0 .7 1 0 0] concat
currentlinewidth 1.5 mul setlinewidth
1 0 0 setrgbcolor
0 0 moveto axis shape stroke
grestore

0 0 moveto axis shape stroke

showpage
============
====== translate.ps ============
%!
/axis {
currentpoint 4 {
2 copy moveto
50 0 lineto
90 rotate
} repeat pop pop
} def
/shape {
20 0 moveto
30 20 lineto
40 0 lineto
closepath
} def

100 100 translate

gsave
15 15 translate
currentlinewidth 1.5 mul setlinewidth
1 0 0 setrgbcolor
0 0 moveto axis shape stroke
grestore

0 0 moveto axis shape stroke

showpage
============

josh@cadabra ~/affine
$

tlvp

unread,
Sep 2, 2015, 4:24:54 PM9/2/15
to
On Tue, 1 Sep 2015 19:42:59 -0700 (PDT), luser- -droog wrote:

> ====== ident.ps ============

Couldn't you replace this with a scale, using scaling-factor 1?
or a rotate, using rotation angle 0? or a translate, using increment 0?

Or maybe you *could*, but you feel you *shouldn't* :-) . No harm.

Another thing: the transformations you give in your OP look as if designed
only for planar figures. It might be nice to extend them to be applicable
to planar projections of 3-D figures, being rotated, scaled, translated,
sheared, etc., around centers or in directions given in space. Idea :-) ?

Cheers, -- tlvp
--
Avant de repondre, jeter la poubelle, SVP.

luser- -droog

unread,
Sep 2, 2015, 6:02:07 PM9/2/15
to
On Wednesday, September 2, 2015 at 3:24:54 PM UTC-5, tlvp wrote:
> On Tue, 1 Sep 2015 19:42:59 -0700 (PDT), luser- -droog wrote:
>
> > ====== ident.ps ============
>
> Couldn't you replace this with a scale, using scaling-factor 1?
> or a rotate, using rotation angle 0? or a translate, using increment 0?
>
> Or maybe you *could*, but you feel you *shouldn't* :-) . No harm.
>

Perhaps I should. I didn't think about that aspect very much.
The whole project of making the illustrations took me about
an hour. Then after posting the images, I realized the programs
themselves were short enough to put in a post.

The rest of the evening went towards explaining the steps and
tools that made it so quick and easy.
http://computergraphics.stackexchange.com/questions/405/how-to-produce-simple-2d-illustrations-to-accompany-geometry-answers

> Another thing: the transformations you give in your OP look as if designed
> only for planar figures. It might be nice to extend them to be applicable
> to planar projections of 3-D figures, being rotated, scaled, translated,
> sheared, etc., around centers or in directions given in space. Idea :-) ?
>

Good ideas. Again, just didn't think that far.


jdaw1

unread,
Sep 3, 2015, 4:33:03 PM9/3/15
to
In early 2008 I wrote code that could do an arbitrary transformation of a path, so not necessarily linear. If wanted, at
http://www.jdawiseman.com/papers/placemat/transformpath.ps
Reply all
Reply to author
Forward
0 new messages