4
$\begingroup$

I'm an artist trying out digital media. I'm very new to Mathematica, however, so excuse me if this a basic question (which I'm sure it is). I did look, though, for anything on this site related to my situation.

I've created a Graphics3D object composed of many shapes, something like

mypoly = Show[Scale[Cone[], {1, 2, 2}], Cylinder[], Rotate[Cylinder...

Everything is working properly, and it looks fine, but I'd like to move it around (rotate it and actually move it in the coordinate space). Apart from individually changing the rotation and center of each component (e.g., Sphere[{1, 0, 0}]), is there something I can do to manipulate one iteration of the whole figure?

Ultimately, I'm going to be creating a bunch of different copies of the object and combining them.

UPDATE:

My attempt at translating the whole figure inspired by this question:

unit = Show[Graphics3D[Cylinder[]], Graphics3D[Scale[Cone[]...
newUnit = Graphics3D[Translate[unit, {1, 0, 0}]]

This only gives me the error "Graphics is not a Graphics3D primitive or directive."

Rotation, however, seems to work fine, though I run into trouble with Show[]:

newUnit = Rotate[unit, 180 Degree]
Show[unit, newUnit] //Could not combine the graphics objects in Show[]
$\endgroup$
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ – Michael E2 Dec 17 '15 at 0:24
  • $\begingroup$ Look at the various geometric transformation functions available in the documentation. Examples are TranslationTransform, RotationTransform, ScalingTransform and ReflectionTransform. A real nice feature is you can apply multiple transforms to a graphics object. $\endgroup$ – Jack LaVigne Dec 18 '15 at 0:29
6
$\begingroup$

You can do many things with the whole figure, f.e. rotate it

gr = Graphics3D[{Red, Opacity@0.5, Scale[Cone[], {1, 2, 2}], Blue, Cylinder[]}]

enter image description here

Animate[
 Graphics3D[Rotate[First@gr, pi, {{1, 0, 0}, {0, 1, 0}}], Options@gr, Boxed -> False],
 {pi, 0, 2 Pi}]

Update

You have to use First. With the above definition of gr

Graphics3D[Translate[First@gr, {10, 0, 0}], Axes -> True];

enter image description here

$\endgroup$
  • $\begingroup$ Thank you for your help! This works well for rotating things. I'm having some issues, though, with translation. $\endgroup$ – Mandelbrot Jan 9 '16 at 20:50
  • $\begingroup$ See update ---------------------- $\endgroup$ – eldo Jan 9 '16 at 21:16
  • $\begingroup$ Awesome, thanks. Last question: Why, if I rotate an object like I did in the update section, can I not use it in show? Is there a way around this? $\endgroup$ – Mandelbrot Jan 9 '16 at 21:47
  • $\begingroup$ This functions: Show[unit, Graphics3D[Rotate[First@unit, 180 Degree, {1, 0, 0}]]]. You have to specify the 3rd parameter of Rotate. $\endgroup$ – eldo Jan 9 '16 at 22:14
  • $\begingroup$ Perfect. Thank you! $\endgroup$ – Mandelbrot Jan 9 '16 at 23:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.