0
$\begingroup$

I have defined a table

Table[Table[
  Graphics3D[
   Cuboid[radijDensity[[j, i]] {-Sin[kotiDensity[[j, i]]], 
      1 - Cos[kotiDensity[[j, i]]], 0}, {radijDensity[[j, i]]*
      Sin[kotiDensity[[j, i]]], 
     radijDensity[[j, i]] (1 - Cos[kotiDensity[[j, i]]]) + 
      visina[[j, i + 1]], 0}]], {i, 1, n + m - 10}], {j, 1, 
  Length[force[[All, 1]]], 1}]

of cuboids.

But what I want is to have all of them on the same plot but at different z axis values. And I don't know how to do it. Something like ListPlot3D just that I want it to show those cuboids.

$\endgroup$
  • 1
    $\begingroup$ "different z axis values" - then you should be changing the $z$-coordinates on the corners of the Cuboid[], no? $\endgroup$ – J. M. is away Aug 3 '15 at 11:38
  • 1
    $\begingroup$ I think not. Because doing so, will add third dimension to the cuboids. And I don't want that. I want them to remain 2D - so it is actually a rectangle but I used Cuboid[] in mathematica only because I want a 3D plot. So the idea is if you imagine an arbitrary shaped sasuage (3D object) I want to show only some slices at specified z values, if z axis is along the sausage. Is that understandable? $\endgroup$ – skrat Aug 3 '15 at 11:56
  • $\begingroup$ Oh yeah... And by "all" cuboids I mean for all indexes i at given index value j, if I use the same notation as in the OP. The idea is to than use Manipulate[] for index j. $\endgroup$ – skrat Aug 3 '15 at 12:59
4
$\begingroup$

Its difficult to work with your question since you don't define your functions and variables but hopefully this example will be enough.

Let's first make a table of cuboids with different z values (but using the same z-value within each cuboid so they are still rectangles). This examples uses the same x and y values for every Cuboid for simplicity, but you can obviously change that.

list = Table[Cuboid[{0, 0, z}, {1, 1, z}], {z, 1, 5}]

Now apply Graphics3D to the list of cuboids

Graphics3D @ list

Picture of Result

By putting different z values for each cuboid, they appear at different levels.

$\endgroup$
  • 1
    $\begingroup$ Doesn't Graphics3D @ list work? $\endgroup$ – Michael E2 Aug 3 '15 at 13:41
  • $\begingroup$ Yes, it actually does. I'm still somewhat new to Mathematica and didn't know Graphics3D could take multiple regions until you said that. I'll modify the post since that is cleaner. Thanks! $\endgroup$ – BenP1192 Aug 3 '15 at 13:47
  • $\begingroup$ You're welcome! $\endgroup$ – Michael E2 Aug 3 '15 at 13:47
1
$\begingroup$

Something like ListPlot3D just that I want it to show those cuboids.

If you need to place the same shape at multiple points either in 2D or 3D, the best solution is Translate. It can take more than one translation vector as the second argument.

Example:

pts = RandomReal[10, {20, 3}];

Graphics3D[
 Translate[
  Cuboid[],
  pts
  ]
 ]

Mathematica graphics

$\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.