Mathematica Asked by Markus Roellig on January 3, 2021
I am trying to use Ellipsoid
in a GraphicsComplex
and I am stuck. My understanding of GraphicsComplex
is that explicit point coordinate assignments are replaced with integer values pointing to a list of coordinates instead.
So instead of
Graphics3D[Sphere[{0, 0, 0}, 1]]
I can use
Graphics3D[GraphicsComplex[{{0, 0, 0}}, Sphere[1, 1]]]
instead. Note, that the first argument of Sphere
is replaced with the first point from the list, i.e. {0,0,0} while the second argument is correctly identified as radius (not coordinate) and not replaced with {0,0,0}.
If I use Ellipsoid
instead, so instead of
Graphics3D[Ellipsoid[{0, 0, 0}, {2, 3, 4}]]
I use
Graphics3D[GraphicsComplex[{{0, 0, 0}}, Ellipsoid[1, {2, 3, 4}]]]
I get an error:
Affine transform 1 should be one of the forms {{{xx, yx, zx}, {xy, yy, zy}, {xz, yz, zz}}, {tx, ty, tz}}; {{xx, yx, zx}, {xy, yy, zy}, {xz, yz, zz}}; or {tx, ty, tz}.
and
Coordinate index 0 is out of range for the enclosing GraphicsComplex.
Two questions: do I use GraphicsComplex
incorrectly? and is there a simple workaround to feed Ellipsoid
s to a GraphicsComplex
?
Note that Ellipsoid
is rendered by using GeometricTransformation
under the hood:
ToBoxes @ Graphics3D[Ellipsoid[{1,1,1}, {2,3,4}]]
Graphics3DBox[ InterpretationBox[ GeometricTransformation3DBox[ SphereBox[{0, 0, 0}], {{{2, 0, 0}, {0, 3, 0}, {0, 0, 4}}, {1, 1, 1}}], Ellipsoid[{1, 1, 1}, {2, 3, 4}]]]
Basically, a sphere at the origin is translated and transformed by the GeometricTransformation3DBox
so that it looks like the desired Ellipsoid
. Now, notice that the center of the Ellipsoid
is part of the transformation argument. Unfortunately, GraphicsComplex
can only handle coordinate indices when they are inside of a normal graphics primitive, in this case inside of SphereBox
. This is why GraphicsComplex
of Ellipsoid
doesn't work. Consider the corresponding GraphicsComplex
version:
ToBoxes @ Graphics3D[GraphicsComplex[{{1,1,1}}, Ellipsoid[1, {2, 3, 4}]]]
Graphics3DBox[ GraphicsComplex3DBox[{{1, 1, 1}}, InterpretationBox[ GeometricTransformation3DBox[ SphereBox[{0, 0, 0}], {{{2, 0, 0}, {0, 3, 0}, {0, 0, 4}}, 1}], Ellipsoid[1, {2, 3, 4}]]]]
If GraphicsComplex3DBox
could understand that the 1
inside the GeometricTransformation3DBox
represented the point {1, 1, 1}
then it would render properly. However, it is tricky figuring out what parts of a such a list correspond to a point, and so GraphicsComplex3DBox
gives up.
Answered by Carl Woll on January 3, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP