4
$\begingroup$

From this answer, I was able to figure out how to get the graphics primitive from a Plot3D. However, this does not seem to work for a RevolutionPlot3D.

Full context: I am following tutorial 7.10 in "Mathematica Cookbook"

Code snippet (full code below):

c1 = RevolutionPlot3D[{t, -height*2t}, {t, 0, base}] 

How can I extract the graphics primitives? from the plot above?

Full Code

Height = 1; Base = 1; theAxis = {1, 1, 1}; theCenterPoint = {0, 0, 0};

C1 = RevolutionPlot3D[
       {t, -Height*2 t}, {t, 0, Base},
       Mesh -> None
     ][[1]]; (*<- Applying the  [[1]] did not work*)

C2 = Rotate[C1, theAxis[[1]], {1, 0, 0}];(*<- I also tried applying the [[1]] the C1 here instead of in the C1 definition*)

C3 = Rotate[C2, theAxis[[2]], {0, 1, 0}];

C4 = Rotate[C3, theAxis[[3]], {0, 0, 1}];

C5 = Translate[
       C4,
       {theCenterPoint[[1]], theCenterPoint[[2]], theCenterPoint[[3]] + Height*Base}
     ]
$\endgroup$
8
$\begingroup$

Use Cases to extract the GraphicsComplex from the plot:

c1 = RevolutionPlot3D[{t, -1*2 t}, {t, 0, 1}];

gc = Cases[c1, _GraphicsComplex, Infinity];

Now use GeometricTransformation to apply different transformation functions onto the graphics:

Graphics3D[
    {
        gc,
        GeometricTransformation[gc /. _RGBColor :> Red, ReflectionTransform @ {0, 0, 1}],
        GeometricTransformation[gc /. _RGBColor :> Blue,
            RotationTransform[Pi / 2, {1, 0, 0}]
        ],
        GeometricTransformation[gc /. _RGBColor :> Green,
            RotationTransform[(-Pi) / 2, {1, 0, 0}]
        ]
    }
]

enter image description here

| improve this answer | |
$\endgroup$

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.