Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Re: Rotation of 3D objects

  • To: mathgroup at smc.vnet.net
  • Subject: [mg86894] Re: Rotation of 3D objects
  • From: Narasimham <mathma18 at hotmail.com>
  • Date: Tue, 25 Mar 2008 01:17:42 -0500 (EST)
  • References: <fqo8u2$t2s$1@smc.vnet.net> <fqqruv$kbq$1@smc.vnet.net>

On Mar 7, 12:47 pm, "David Park" <djmp... at comcast.net> wrote:
> Here is some code for those who have the Presentations package.
>
> For reflection in a mirror:
>
> Needs["Presentations`Master`"]
>
> Module[
>  {(* object to reflect *)
>   gr = ParametricDraw3D[{t, u + t, u t/5}, {t, 0, 2}, {u, -1, 1},
>     Mesh -> 5,
>     BoundaryStyle -> Black],
>   (* Mirror location and normal *)
>   p = {1, 1, 2},
>   normal = {0, 0, 1},
>   vector1, vector2},
>  {vector1, vector2} = NullSpace[{normal}];
>  Draw3DItems[
>   {(* Original object *)
>    {Opacity[.7, HTML[DarkSeaGreen]], gr},
>    (* Reflected object *)
>    {Opacity[.7, HTML[DodgerBlue]], gr} //
>     ReflectionTransformOp[normal, p],
>    (* Draw the mirror *)
>    {Opacity[0.3, HTML[SkyBlue]],
>     ParametricDraw3D[
>      p + s vector1 + t vector2, {s, -3, 3}, {t, -3, 3},
>      Mesh -> None]}},
>   NeutralLighting[0, 0.6, .1],
>   NiceRotation,
>   ViewPoint -> {2, -2.4, .6},
>   Boxed -> False,
>   ImageSize -> 300]
>  ]
>
> Multiple copies of rotation about an axis:
>
> Module[
>  {(* object to reflect *)
>   gr = ParametricDraw3D[{t, u + t, u t/5}, {t, 0, 2}, {u, -1, 1},
>     Mesh -> 5,
>     BoundaryStyle -> Black],
>   (* axis, location and number of copies *)
>   axis = {1, 1, 0},
>   axislocation = {-1.5, -1.5, 2},
>   ncopies = 4,
>   rotationangle},
>  rotationangle = 2 \[Pi]/ncopies;
>  Draw3DItems[
>   {(* Rotations *)
>    {Opacity[.7, HTML[DarkSeaGreen]],
>     Table[gr //
>       RotationTransformOp[n rotationangle, axis, axislocation], {n, =
0,
>        ncopies - 1}]},
>    (* Draw the axis *)
>    Red, Arrow3D[axislocation, axislocation + 5 axis, {.10}]},
>   NeutralLighting[0, 0.6, .1],
>   NiceRotation,
>   ViewPoint -> {-1, -2.4, .6},
>   Boxed -> False,
>   ImageSize -> 300]
>  ]
>
> A Manipulate statement allowing the rotation about an axis by an adjustabl=
e
> angle theta.
>
> Manipulate[
>  Module[
>   {(* object to reflect *)
>    gr = ParametricDraw3D[{t, u + t, u t/5}, {t, 0, 2}, {u, -1, 1},
>      Mesh -> 5,
>      BoundaryStyle -> Black],
>    (* axis direction and location *)
>    axis = {1, 1, 0},
>    axislocation = {-1.5, -1.5, 2}},
>   Draw3DItems[
>    {(* Original object *)
>     {Opacity[.7, HTML[DarkSeaGreen]], gr},
>     (* Rotated object *)
>     {Opacity[.7, HTML[DodgerBlue]],
>      gr // RotationTransformOp[\[Theta], axis, axislocation]},
>     (* Draw the axis *)
>     Red, Arrow3D[axislocation, axislocation + 5 axis, {.10}]},
>    NeutralLighting[0, 0.6, .1],
>    NiceRotation,
>    PlotRange -> {{-1, 4}, {-1, 4}, {-1, 5}},
>    ViewPoint -> {-1, -2.4, .6},
>    Boxed -> False,
>    ImageSize -> 300]
>   ],
>  Style["Rotation about axis by angle \[Theta]", 16],
>  {\[Theta], 0, 2 \[Pi], Appearance -> "Labeled"}]
>
> --
> David Park
> djmp... at comcast.nethttp://home.comcast.net/~djmpark/
>
> "Narasimham" <mathm... at hotmail.com> wrote in message
>
> news:fqo8u2$t2s$1 at smc.vnet.net...
>
>
>
> > By what command is it possible to create (without writing a code
> > separately ):
>
> > 1) Reflections of 3D objects about a plane?
>
> > 2) Multiple copies equally spaced  by rotation around an axis through
> > two given points?
>
> > E.g.,
> > surf = ParametricPlot3D[{ t,u+t, u*t/5}, {t,0,2},{u,-1,1}];
> > Rotate[surf,Axis->{ {-1,-1,-1},{1,1,1}} , Copies-> 4 ] ;     and,
>
> > 3) A single rotation of given object through a given angle on an axis
> > through two defined points?
>
> > Thanks in advance
>
> > Narasimham- Hide quoted text -
>
> - Show quoted text -

Actually in engineering drawing software e.g., CATIA, Autocad Pro E
&c. such 3D operations are routinely  implemented, clicking on a
standard GUI...the mathematical basis of which I was sure is well
within Mathematica's range of computational capabilities. ( and it
also appeared in 200 seconds. ).Mathematica gives the user an
advantage to see those steps, or look into the black box.Of course,
some minimum code lines have to be written.

Regards,
Narasimham



  • Prev by Date: Re: Counting nonzeros
  • Next by Date: Re: Re: Re: Re: Re: smallest
  • Previous by thread: Re: Rotation of 3D objects
  • Next by thread: Assignment problem