I am trying to visualize a 3D section of a chopped up 1x1x1 Cube. I don't want to use the Cube[] function to draw this. (unless you think you can still accomplish it that way). Ok, so say you have a simple XY plane, laying flat on the table (lengths 1x1) Now I draw 2 straight lines across it with equations: Y=X+1/2 and Y=X-1/2 and shade the region in between. (it'll take up 75% of the 1x1 region of course with the top left and bottom right squares being half shaded now, and the other 2 squares fully shaded). Ok simple enough so far.

Now let's draw up the Z-axis above this (Hold the ruler perpendicular to the table up to a height of 1). Now raise/stretch that same shaded region above to the top, which will still take up the 75% of the now-8 0.5x0.5 cubes). with 2/8 unshaded. Ok now imagine the ZX plane (facing you on the table) and draw up the same 2 equations, now: Z=X+1/2 and Z=X-1/2 so you now have the same regions covering the ZX plane and they now travel to the back of the Cube - and the main point, now intersect the previous region (coming up from XY plane).

I like to visualize both shaded intersection. In other words, how can I draw up both regions, shade them, then put them into 3D for both planes and be able to rotate that final 3D image in any direction I like to visualize that highlighted 3D-intersection.

P.S. Too much in language, for those who like pure equations, in a nutshell this is all I need:

Y=X(+/-)1/2 and Z=X(+/-)1/2 < == 3D Plot and visualize intersection region in between the 2 pairs of lines on each plane.

Assume/hope your solution can take in any Function cutting the cube: Say Y=f(X) and Z=g(X)?

Co-incidentally, assume this is also possible to solve algebraically?


Reply the comment.


 And @@ {x - 1/2 <= y <= x + 1/2, x - 1/2 <= z <= x + 1/2, 
   0 <= x <= 1, 0 <= y <= 1, 0 <= z <= 1}, {x, 0, 1}, {y, 0, 1}, {z, 
  0, 1}, PlotPoints -> 80, PlotStyle -> Opacity[0.2], Mesh -> None, 
 BoundaryStyle -> Blue, AxesLabel -> {"x", "y", "z"}, 
 LabelStyle -> Directive[Red, Bold], TicksStyle -> Orange]

enter image description here

  • $\begingroup$ Thx @cvgmt! Looks great, I plotted it. Last thing: Can I put the X,Y,Z labels on the axis so when I rotate it around, I know which plane I'm looking at? $\endgroup$ – Steve237 Nov 19 '20 at 3:26
  • 1
    $\begingroup$ @Steve237 Yes, we can add AxesLabel -> {"x", "y", "z"}. I add some codes to the answer. $\endgroup$ – cvgmt Nov 19 '20 at 3:35
  • $\begingroup$ Thx, works great! $\endgroup$ – Steve237 Nov 19 '20 at 3:43

Here is an approach that seems to stem from the equations you mentioned at the end. I am not sure that I have interpreted them correctly, but even if I have not, perhaps it will get you started:

    {x - 1/2 <= y <= x + 1/2, x - 1/2 <= z <= x + 1/2}, {x, y, z}
  {{0, 1}, {0, 1}, {0, 1}},
  Axes -> True, Boxed -> True,
  Method -> "Semialgebraic"

3D representation of region

  • $\begingroup$ Yes this is great Marco, Thx! Is there a way for Mathematica to compute the percentage of shaded area? $\endgroup$ – Steve237 Nov 18 '20 at 3:03
  • $\begingroup$ @Steve237 reg = ImplicitRegion[{x - 1/2 <= y <= x + 1/2, x - 1/2 <= z <= x + 1/2 , 0 <= x <= 1, 0 <= y <= 1, 0 <= z <= 1}, {x, y, z}] // Volume // N $\endgroup$ – cvgmt Nov 18 '20 at 3:14
  • $\begingroup$ Thx cvgmt! Is there a way to make the original shape transparent/see-thru? $\endgroup$ – Steve237 Nov 18 '20 at 4:58
  • $\begingroup$ @Steve237 I add an answer to reply you. $\endgroup$ – cvgmt Nov 18 '20 at 5:40
  • $\begingroup$ @cvgmt Do you know why I get ripples behind the 3D figure? are these glitches? Link $\endgroup$ – Steve237 Nov 19 '20 at 3:51

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.