7
$\begingroup$

I hope I am not doing something wrong.

Compare the following figures.

1) Ellipsoid

Graphics3D[{{Specularity[White, 40], Opacity[0.5], 
   Ellipsoid[{0, 0, 0}, {10, 3, 2}]}, {Opacity[1], 
   Ellipsoid[{0, 0, 0}, {0, 3, 2}], Ellipsoid[{0, 0, 0}, {10, 0, 2}], 
   Ellipsoid[{0, 0, 0}, {10, 3, 0}]}}, ImageSize -> Large]

enter image description here

2) The same goal but in a more "user-defined" way

 Graphics3D[{Specularity[White, 40], Opacity[0.5], 
        Scale[#, {10, 3, 2}], {Opacity[1], Scale[#, {.001, 3, 2}], 
         Scale[#, {10, 0.001, 2}], Scale[#, {10, 3, 0.001}]}} &@Sphere[], 
     ImageSize -> Large]

enter image description here

Why the quality of the first Graphics3D is so bad?

$Version

(*"10.3.0 for Linux x86 (64-bit) (October 9, 2015)"*)
$\endgroup$
  • $\begingroup$ Check out @Taiki's answer to this question for the ellipse3D function that draws 2D ellipses in 3D space. $\endgroup$ – shrx Nov 20 '15 at 11:02
  • 2
    $\begingroup$ I upvoted Jasons answer, but the correct way would be to implement a 2d ellipse for 3d space using e.g. polygon. If you do such things like scaling one dimension of a 3d object to a very thin plate, is never a good idea and can still lead to artifacts. On the long run, you should follow shrx's suggestion above. $\endgroup$ – halirutan Nov 20 '15 at 11:20
  • $\begingroup$ Thanks for the useful comments. (@shrx and @halirutan) $\endgroup$ – Dimitris Nov 20 '15 at 11:44
6
$\begingroup$

The problem with the first graphic is that you are trying to create a 3D object with exactly zero width in one dimension. In the second graphic, you make the width in that dimension equal to a small value. This same workaround can be applied to the Ellipsoid call,

Graphics3D[{{Specularity[White, 40], Opacity[0.5],
   Ellipsoid[{0, 0, 0}, {10, 3, 2}]},
  {Opacity[1],
   Ellipsoid[{0, 0, 0}, {0.001, 3, 2}],
   Ellipsoid[{0, 0, 0}, {10, 0.001, 2}],
   Ellipsoid[{0, 0, 0}, {10, 3, 0.001}]}}, ImageSize -> Large]

enter image description here

Thanks to shrx for pointing out a better way to do this, as shown in in this post by Taiki. Using the function ellipse3D[center,{r1,r2},normal], which takes as argument the center position, the two semiaxes, and the normal vector to the plane, we get

Graphics3D[{{Specularity[White, 40], Opacity[0.5], 
   Ellipsoid[{0, 0, 0}, {10, 3, 2}]},
  {Opacity[1], EdgeForm[None], 
   ellipse3D[{0, 0, 0}, {2, 3}, {1, 0, 0}], 
   ellipse3D[{0, 0, 0}, {10, 2}, {0, 1, 0}], 
   ellipse3D[{0, 0, 0}, {10, 3}, {0, 0, 1}]}}, ImageSize -> Large]

enter image description here

giving an identical looking result which, as halirutan says, will behave better in the long run.

$\endgroup$
  • $\begingroup$ Thanks. I thought I can create directly a disk with Ellipsoid. Should I change the title of the question since the error belongs to me and to Mathematica? $\endgroup$ – Dimitris Nov 20 '15 at 11:02
  • $\begingroup$ Or change the title to reflect that the problem is how to include 2 dimensional disks in a Graphics3D object, which is something others may search for. This is one workaround, giving it a really small width $\endgroup$ – Jason B. Nov 20 '15 at 11:04

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.