(*^ ::[ frontEndVersion = "Macintosh Mathematica Notebook Front End Version 2.1"; macintoshStandardFontEncoding; paletteColors = 128; automaticGrouping; currentKernel; fontset = title, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, e8, 24, "Times"; ; fontset = subtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, e6, 18, "Times"; ; fontset = subsubtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, italic, e6, 14, "Times"; ; fontset = section, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, grayBox, M22, bold, a20, 18, "Times"; ; fontset = subsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, blackBox, M19, bold, a15, 14, "Times"; ; fontset = subsubsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, whiteBox, M18, bold, a12, 12, "Times"; ; fontset = text, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; ; fontset = smalltext, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 10, "Times"; ; fontset = input, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeInput, M42, N23, bold, L-5, 12, "Courier"; ; fontset = output, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L-5, 12, "Courier"; ; fontset = message, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, R65535, L-5, 12, "Courier"; ; fontset = print, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L-5, 12, "Courier"; ; fontset = info, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, B65535, L-5, 12, "Courier"; ; fontset = postscript, PostScript, formatAsPostScript, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeGraphics, M7, l34, w282, h287, 12, "Courier"; ; fontset = name, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, italic, 10, "Geneva"; ; fontset = header, inactive, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; ; fontset = leftheader, inactive, L2, 12, "Times"; ; fontset = footer, inactive, noKeepOnOnePage, preserveAspect, center, M7, 12, "Times"; ; fontset = leftfooter, inactive, L2, 12, "Times"; ; fontset = help, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 10, "Times"; ; fontset = clipboard, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; ; fontset = completions, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; ; fontset = special1, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; ; fontset = special2, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; ; fontset = special3, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; ; fontset = special4, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; ; fontset = special5, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; ; ] :[font = special1; inactive; preserveAspect; ] Rigid Transformations Each of the four cells below defines one of the four basic kinds of rigid transformations and then does one or more examples. Evaluate each of these four cells now and experiment with each of the four basic kinds of rigid transformations. ;[s] 4:0,1;66,0;195,2;306,0;308,-1; 3:2,13,9,Times,0,12,0,0,0;1,13,9,Times,1,12,0,0,0;1,13,9,Times,1,12,65535,0,0; :[font = input; preserveAspect; ] Mirror[x_] := {x[[1]], -x[[2]]} Mirror[{1, 3}] :[font = input; preserveAspect; ] Trans[x_, a_] := x + a Trans[{1, 3}, {5, 8}] :[font = input; preserveAspect; ] Rotate[x_, theta_] := {x[[1]] Cos[theta] - x[[2]] Sin[theta], x[[1]] Sin[theta] + x[[2]] Cos[theta]} Rotate[{1, 2}, Pi/2] :[font = input; preserveAspect; ] Ident[x_] := x Ident[{1, 4}] :[font = special1; inactive; preserveAspect; ] The next cell defines a smiley face. Later on we will explore the ways in which images like this one can be manipulated using the four basic kinds of rigid transformations defined above. Evaluate the next cell now. ;[s] 3:0,0;189,1;215,0;217,-1; 2:2,13,9,Times,0,12,0,0,0;1,13,9,Times,1,12,65535,0,0; :[font = input; preserveAspect; ] Outline := Table[N[{2 Cos[2 Pi k/16], 2.5 Sin[2 Pi k/16]}], {k, 0, 16}] Smiley := Join[Outline, {{0, 0}}, {{-0.5, 1}}, {{0.5, 1}}, {{-1.0, -0.7}}, {{-0.5, -1.2}}, {{0.5, -1.2}}, {{1.0, -0.7}}] Face := {RGBColor[0.4, 0.4, 0.4], Thickness[0.01], Line[Table[AllPoints[[k]], {k, 1, 17}]]} Nose := {RGBColor[0, 0, 0], PointSize[0.04], Point[AllPoints[[18]]]} LeftEye := {RGBColor[0, 0, 1], PointSize[0.04], Point[AllPoints[[19]]]} RightEye := {RGBColor[0, 0, 1], PointSize[0.04], Point[AllPoints[[20]]]} Mouth := {RGBColor[1, 0, 0], Thickness[0.015], Line[{AllPoints[[21]], AllPoints[[22]], AllPoints[[23]], AllPoints[[24]]}]} ShowSmiley[] := Show[Graphics[{Face, Nose, LeftEye, RightEye, Mouth}], PlotRange -> {{-5, 5}, {-5, 5}}, Axes -> False, Frame -> True, AspectRatio -> Automatic] AllPoints := Smiley ShowSmiley[] :[font = special1; inactive; preserveAspect; ] The next cells illustrate how images like the smiley face can be manipulated using transformations like the transformations above by applying the transformation to each of the points in the image. Evaluate them now. ;[s] 3:0,0;198,1;215,0;217,-1; 2:2,13,9,Times,0,12,0,0,0;1,13,9,Times,1,12,65535,0,0; :[font = input; preserveAspect; ] AllPoints := Table[Mirror[Smiley[[k]]], {k, 1, Length[Smiley]}] ShowSmiley[] ;[s] 3:0,0;19,1;38,0;116,-1; 2:2,12,10,Courier,1,12,0,0,0;1,12,10,Courier,1,12,65535,0,65535; :[font = input; preserveAspect; ] AllPoints := Table[Trans[Smiley[[k]], {1, 1}], {k, 1, Length[Smiley]}] ShowSmiley[] ;[s] 3:0,0;19,1;45,0;123,-1; 2:2,12,10,Courier,1,12,0,0,0;1,12,10,Courier,1,12,65535,0,65535; :[font = special1; inactive; preserveAspect; ] The most important parts of each cell above are the parts Mirror[Smiley[[k]]] and Trans[Smiley[[k]], {1, 1}] that apply a rigid transformation to the points that make up the image of the smiley face. Now you can use the same ideas to experiment with other rigid transformations. ;[s] 5:0,0;59,1;80,0;83,1;113,0;284,-1; 2:3,13,9,Times,0,12,0,0,0;2,13,10,Courier,1,12,65535,0,65535; ^*)