I'm trying to clip a cone both from top and bottom using IntervalSlider. I'm able to clip it from the bottom but not from the top.

 Graphics3D[{FaceForm[Green, Pink], Cone[]}, 
  ClipPlanes -> {InfinitePlane[{{0, 0, z[[1]]}, {1, 0, z[[1]]}, {0, 1,
    InfinitePlane[{{0, 0, -z[[2]]}, {1, 0, -z[[2]]}, {0, 
       1, -z[[2]]}}]}], {z, -1, 1, ControlType -> IntervalSlider, 
 Method -> "Push", MinIntervalSize -> 0.1}]

Any help?


1 Answer 1


The problem is, how to specify that the plane should cut content below or above itself.


I couldn't find notes about that in documentation but it seems, and is reasonable, that the order of points in InfinitePlane's specification determines that. So if you reverse the order of points in the second plane you will get what you need.


Clipping is controlled by FE so you can use ClipPlanes -> Dynamic[...]. This will improve performance as the whole Graphics3D will not need to be recreated each time.

Final code

     Graphics3D[{FaceForm[Green, Pink], Cone[]}
       , ClipPlanes -> Dynamic@{
           InfinitePlane[{{0, 0, z[[1]]}, {1, 0, z[[1]]}, {0, 1, z[[1]]}}], 
             Reverse@{{0, 0, z[[2]]}, {1, 0, z[[2]]}, {0, 1, z[[2]]}}
  , {z, -1, 1
    , ControlType -> IntervalSlider
    , Method -> "Push"
    , MinIntervalSize -> 0.1

enter image description here


Your Answer

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

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