Re: Rotating a list of 3D point coordinates in one shot
- To: mathgroup at smc.vnet.net
- Subject: [mg100022] Re: Rotating a list of 3D point coordinates in one shot
- From: Albert Retey <awnl at gmx-topmail.de>
- Date: Fri, 22 May 2009 01:43:00 -0400 (EDT)
- References: <gv2k0e$9gs$1@smc.vnet.net>
Bill wrote:
> Hi:
>
> I have a list of 3D coordinates:
>
> list={{1., 0., 0.}, {0.987688, 0.156434, 0.},
> {0.951057, 0.309017, 0.}, {0.891007, 0.45399, 0.}, {0.809017, 0.587785,=
0.}, {0.707107, 0.707107, 0.},
> {0.587785,0.809017, 0.}, {0.45399, 0.891007, 0.}, {0.309017, 0.951057, =
0.}, {0.156434, 0.987688, 0.},
> {0., 1., 0.}, {-0.156434, 0.987688, 0.},
> {-0.309017, 0.951057, 0.}, {-0.45399, 0.891007, 0.},
> {-0.587785, 0.809017, 0.}, {-0.707107, 0.707107, 0.},
> {-0.809017, 0.587785, 0.}, {-0.891007, 0.45399, 0.},
> {-0.951057, 0.309017, 0.}, {-0.987688, 0.156434, 0.},
> {-1., 0., 0.}}.
>
> I'd like to rotate all the coordinates in the list in one shot, using s=
omething like this:
>
> Rotate[list, 180 Degree, {-1, -2, -1}]}} (*Axis angle rotation.*)
>
> I haven't gotten this to work though. I can rotate a single point at a =
time using a similiar method, but
> that is very time consuming.
>
> Question: Is there a way to rotate a list of numerous 3D coordinates s=
uch as in my example above, and if so, how do I code that using Mathemati=
ca 6.0.1?
>
Rotate is for graphics primitives, not for just coordinates, so any of
the following will work:
Graphics3D[Rotate[Line[list], 180 =B0, {-1, -2, -1}]]
Graphics3D[Rotate[Point[list], 180 =B0, {-1, -2, -1}]]
If you inspect the output with FullForm you will notice that the
rotation is not resolved by the Kernel, but obviously only the rendering
system will be doing the final rotate. I think this might be much more
efficient.
If you have things that consist of more than just one graphics
primitive, you can rotate them all together by grouping them with a
list, e.g.:
lineandpoints = {Red, Point[list], Opacity[0.5], Black, Line[list]};
Graphics3D[Rotate[lineandpoints,180 Degree, {-1, -2, -1}]]
hth,
albert