MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: Questions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg27280] RE: [mg27267] Questions
  • From: "David Park" <djmp at earthlink.net>
  • Date: Sat, 17 Feb 2001 03:30:55 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Tony,

Here is a routine that should do what you want. Copy them into your
notebook.

Isometry2D::"usage" = "Isometry2D[\[Theta], tr, \[Epsilon]] gives a pure \
function which represents the general isometry of the plane in terms of an \
angle, \[Theta], and a translation vector, tr. If \[Epsilon] == 1, the plane
\
is rotated counterclockwise about the origin by the angle \[Theta] and then
\
translated by tr. If \[Epsilon] == -1, the plane is reflected through a line
\
at the angle \[Theta]/2 and then translated by tr. Isometry2D[\[Theta], tr,
\
\[Epsilon]][x,y] gives the transformation, or alibi, of the point {x, y}.\n\
Examples:\nIsometry2D[\[Pi]/4,{a,b},1][1,0] \[Implies] {\!\(1\/\@2\) + a, \
\!\(1\/\@2\) + b}\nIsometry2D[\[Theta],{a,b},-1][x,y] \[Implies] {a + x
Cos[\
\[Theta]] + y Sin[\[Theta]], b - y Cos[\[Theta]] + x Sin[\[Theta]]}.";

Isometry2D[\[Theta]_, tr:{_, _}, (\[Epsilon]_)?(MatchQ[#1, 1 | -1] & )] :=
  Evaluate[{{Cos[\[Theta]], -Sin[\[Theta]]}, {Sin[\[Theta]], Cos[\[Theta]]}}
. {{1, 0}, {0, \[Epsilon]}} .
      {#1, #2} + tr] &

Here is a rotation and translation of triangle0, and a reflection of
triangle0 through a line.

triangle0 = Line[{{0, 0}, {1, 0}, {1/2, 1}, {0, 0}}];
triangle1 = triangle0 /. {(x_)?NumericQ, (y_)?NumericQ} :>
     Isometry2D[Pi/4, {0, 1/4}, 1][x, y];
triangle2 = triangle0 /. {(x_)?NumericQ, (y_)?NumericQ} :>
     Isometry2D[Pi/2, {0, 0}, -1][x, y];

Show[Graphics[{triangle0, Blue, triangle1, Red, triangle2}],
   AspectRatio -> Automatic];

Here are two successive rotation of triangle0.

triangle0 = Line[{{0, 0}, {1, 0}, {1/2, 1}, {0, 0}}];
triangle1 = triangle0 /. {(x_)?NumericQ, (y_)?NumericQ} :>
     Isometry2D[Pi/4, {0, 0}, 1][x, y];
triangle2 = triangle1 /. {(x_)?NumericQ, (y_)?NumericQ} :>
     Isometry2D[Pi/4, {0, 0}, 1][x, y];

Show[Graphics[{triangle0, Blue, triangle1, Red, triangle2}],
   AspectRatio -> Automatic];

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/


> From: Tony [mailto:tony at magic101.freeserve.co.uk]
To: mathgroup at smc.vnet.net
>
> Does mathematica do reflections rotations of a given shape.
> I mean if I plot a triangle if I had a fuction such as
>
> f: R2 --> R2
> (x,y) I--->(y,x)
>
> Would mathematica do this and would it carry out composite
> function such as
> GoF   and FoG etc
>
> Oh so many questions to ask and so little time to .........
>
> Tony
>



  • Prev by Date: Re: numerics
  • Next by Date: Re:Interactive Display
  • Previous by thread: Re: Questions
  • Next by thread: Re: Questions