MathGroup Archive 2002

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

Search the Archive

RE: Geometry- transformations

  • To: mathgroup at smc.vnet.net
  • Subject: [mg34383] RE: [mg34360] Geometry- transformations
  • From: "David Park" <djmp at earthlink.net>
  • Date: Fri, 17 May 2002 06:31:16 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hrvoje,

Here is a method for creating your snail patterns.

This will rotate counterclockwise about the z axis by t radians.

rotate[t_] := {{Cos[t], -Sin[t], 0}, {Sin[t], Cos[t], 0}, {0, 0, 1}}

This will scale all points from the origin by a factor of r.

expand[r_] := {{r, 0, 0}, {0, r, 0}, {0, 0, r}}

Here, we apply these two matrices to a point {x,y,z} and then shift in the z
direction by dz.

(rotate[t].expand[r]).{x, y, z} + {0, 0, dz}
{r x Cos[t] - r y Sin[t], r y Cos[t] + r x Sin[t], dz + r z}

Now, create a one step transform function which applies itself to the list
of point coordinates. (This is probably a little difficult for a new user
because I am using a pure function, actually a nested pure function. So you
have to look up and see how pure functions work. They are very useful!)

transform[t_, r_, dz_] =
    Function[{x, y, z}, {r x Cos[t] - r y Sin[t], r y Cos[t] + r x Sin[t],
            dz + r z}] @@ # &;

This tries our transform function on a test point.

testpoint = {1, 0, 0};
transform[1 Degree, 1.1, -0.01][testpoint]
{1.09983, 0.0191976, -0.01}

Here is an initial list of points, the corners of a square in the xy-plane.

points0 = {{-1, -1, 0}, {1, -1, 0}, {1, 1, 0}, {-1, 1, 0}};

We can generate successive sets of points by using NestList. (I used a pure
function again! It maps our transformation onto each successive list of
points.) This generates 201 sets of our points, starting with the initial
set of points. (Try this statement without the semicolon, replacing 200 by
3, say, to see how it works.)

outpoints = NestList[transform[5 Degree, 1.05, -0.05] /@ # &, points0, 200];

Now, we can plot all of our points, converting the point lists into
graphical Points.

Show[Graphics3D[outpoints /. {x_, y_, z_} -> Point[{x, y, z}]], PlotRange ->
All,
   ImageSize -> 500];

Even more fun is:

<< "RealTime3D`"
Show[Graphics3D[outpoints /. {x_, y_, z_} -> Point[{x, y, z}]], ImageSize ->
500];
<< "Default3D`"

Happy snail hunting!

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


> -----Original Message-----
> From: Hrvoje Posilovic [mailto:hposilovic at inet.hr]
To: mathgroup at smc.vnet.net
> Sent: Thursday, May 16, 2002 5:09 AM
> Subject: [mg34383] [mg34360] Geometry- transformations
>
>
> Dear Mathematica  experts,
>
> I am very new Mathematica user and have one problem
> which is for me impossible to solve.
> I must define geometric shape by set of points in XY  plane and
> than rotate
> that shape (points) in steps of 1 deg around Z axis for 3 or 4
> revolutions,
> at the same time that
> shape must be resized (magnified)  by sale fator R for 1 deg reolution
> step, and translated downward Z axis by translation factor T for 1 deg
> revolution step.
> All three transforations must be done at the same time.
> That will generate shape similat to snail shell.
> At the end must read all coordinate points generated.
> I do not want to render or draw generated shape but only
> to have coordinates of all the points generaded from the
> initial points.
>
> I do not know is it possible to do something like that with Mathematica.
> I will appreciate any help.
>
> Best Regards
> Hrvoje Posilovic
> 10000 Zagreb
> Croatia
> hposilovic at inet.hr
>
>
>
>
>
> coordinates
> --
> Hrvoje
>
> hposilovic at inet.hr
>



  • Prev by Date: Package Problems
  • Next by Date: RE: solving vector equations in mathematica
  • Previous by thread: Re: Geometry- transformations
  • Next by thread: Re: Geometry- transformations