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$
2
  • $\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, 2015 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$ Dec 18, 2015 at 0:29

1 Answer 1

7
$\begingroup$

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

gr = Graphics3D[{Red, [email protected], 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$
5
  • $\begingroup$ Thank you for your help! This works well for rotating things. I'm having some issues, though, with translation. $\endgroup$
    – Mandelbrot
    Jan 9, 2016 at 20:50
  • $\begingroup$ See update ---------------------- $\endgroup$
    – eldo
    Jan 9, 2016 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, 2016 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, 2016 at 22:14
  • $\begingroup$ Perfect. Thank you! $\endgroup$
    – Mandelbrot
    Jan 9, 2016 at 23:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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