1
$\begingroup$

I would like to create a Graphics3D entity consisting of a human eyeball and a complex figure defined elsewhere. (For a minimal working example, assume that the other object is a Sphere[].) I need to adjust (transform) the position of the eyeball (not of the other components).

Creating the eyeball is straightforward:

eyeball = 
 Show[
 Entity["AnatomicalStructure", "RightEyeball"]["Graphics3D"],
  ViewPoint -> {-1, -.6, 0}]

eyeball

I can put the eyeball and sphere in the same Graphics3D by:

Show[eyeball, Graphics3D[Sphere[]]]

Alas, they do not have the proper relative positions (of course).

I can also simply translate the Sphere.

But because my full graphics has lots of components that are carefully arranged, I need to translate just the eyeball. I have tried all manner of

Graphics3D[GeometricTransformation[eyeball,
  TranslationTransform[{5, 5, 5}]]]

and so forth, without success.

How can I move (in three dimensions) the eyeball to place it wherever I want in a large, complex Graphics3D environment that contains other elements?

$\endgroup$
  • $\begingroup$ for translation you can use Graphics3D[GeometricTransformation[Sphere[], TranslationTransform[Mean/@PlotRange[eyeball]]]]. $\endgroup$ – kglr Jul 18 at 1:16
  • $\begingroup$ @kglr: That's useful--and close--but not quite what I need. I do not want to translate the Sphere, as I mentioned. There must be some way to translate just the eyeball. Instead, I merely want to translate the eyeball. Moreover, I do not want to translate it to the mean of the other object... it has to be set at a very special position. $\endgroup$ – David G. Stork Jul 18 at 1:19
  • $\begingroup$ how about Graphics3D[{GeometricTransformation[eyeball[[1]], RescalingTransform[PlotRange@eyeball, {{-1, 1}, {-1, 1}, {-1, 1}}]]}, Axes->True]? $\endgroup$ – kglr Jul 18 at 1:42
  • $\begingroup$ @kglr: Nope. You've rescaled the eyeball, but not translated it. There must be something about the internal representation of the AnatomyData the prevents the objects from being translated... no? $\endgroup$ – David G. Stork Jul 18 at 1:47
  • $\begingroup$ David, RescalingTransform does both translation and scaling: "Rescaling transformation is a composition of scaling and translation". More generally, you can use RescalingTransform[PlotRange@eyeball, PlotRange[Graphics3D[Sphere[]]]]] (replace Sphere[] with your 3D primitives). $\endgroup$ – kglr Jul 18 at 1:53
3
$\begingroup$

You can try

GeometricTransformation[eyeball[[1]], 
   TranslationTransform[{x0, y0, z0} - Mean /@ (PlotRange @ eyeball) ]]

to translate the center of eyeball to {x0, y0, z0}.

Manipulate[Graphics3D[{{Red, Sphere[]}, PointSize[Large], Point[{x0, y0, z0}], 
   Opacity[.2],
   GeometricTransformation[eyeball[[1]], 
      TranslationTransform[{x0, y0, z0} - Mean /@ (PlotRange @ eyeball) ]]},
  Axes -> True, AxesOrigin -> {x0, y0, z0}, ImageSize -> 400],
 {{x0, -5}, -10, 10, LabeledSlider},
 {{y0, 7}, -10, 10, LabeledSlider},
 {{z0, -3}, -10, 10, LabeledSlider}]

enter image description here

$\endgroup$
  • $\begingroup$ There. Thanks. ($\checkmark$) $\endgroup$ – David G. Stork Jul 18 at 3:07

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.