MathGroup Archive 2001

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

Search the Archive

Re: RotateShape[Cuboid...


Hi,

have alook into the Graphics`Shapes`

source code


RotateShape[ shape_, phi_, theta_, psi_ ] :=
    Block[{rotmat = RotationMatrix3D[N[phi], N[theta], N[psi]]},
	shape /. { poly:Polygon[_] :> Map[(rotmat . #)&, poly, {2}],
		   line:Line[_]    :> Map[(rotmat . #)&, line, {2}],
		   point:Point[_]  :> Map[(rotmat . #)&, point,{1}] }
    ]

and you see ...
no rule for Cuboid[] and so it is not rotated at all.

Regards
   Jens


roelb wrote:
> 
> Hi,
> On Mathematica3 for mac, the following input produces 2 rods crossing
> with a 90° angle, as expected. That's OK.
> 
> Show[Graphics3D[Cylinder[.3,1,10] ],RotateShape[
>          Graphics3D[Cylinder[.3,1,10 ] ],
>                   0,Pi/2,0]]
> 
> But a quite similar RotateSphape input applied to Cuboids doesn't behave
> in the same manner. Why? (I expected the top Cudoid being oriented
> differently than the botton one).
> 
> Show[Graphics3D[Cuboid[{-1,-1,0},{1,1,1}]] ,
>   RotateShape[Graphics3D[Cuboid[{-1,-1,1},{1,1,2}]],
>                  0,1,0]]
> 
> The mathematica book state that cuboids faces are parallel to the axes.
> Should it means that RotateShape doesn't apply?


  • Prev by Date: InitializationCellEvaluation
  • Next by Date: non-linear system
  • Previous by thread: RE: RotateShape[Cuboid...
  • Next by thread: Problems in rendering Graphics3D with RealTime3D (Mathematica 4.1)