Edit: All the four answers to this question are great, and if you're interested, you should take a look at all the answers. Nevertheless, belisarius' code was accepted since it was closest to what I had in mind.
I'm trying to use Mathematica to help students better understand 3-dimensional views of objects, specifically the "plan view", the "side elevation view" and the "front elevation view", as elaborated upon here.
Given the following example "building", I was able to combine Graphics3D
primitives to simulate the object using the following code.
dee = Graphics3D[{Green, Opacity[0.6], Cuboid[{0, 0, 0}, {2/3, 1, 1}],
Red, Polygon[{{{2/3, 1/2, 0}, {2/3, 1/2, 1}, {3/2, 1/2, 0}},
{{2/3, 1, 0}, {2/3, 1, 1}, {3/2, 1, 0}},
{{2/3, 1/2, 0}, {2/3, 1, 0}, {3/2, 1, 0}, {3/2, 1/2, 0}},
{{2/3, 1/2, 1}, {2/3, 1, 1}, {3/2, 1, 0}, {3/2, 1/2, 0}}}]}]
However, as you can see, the code is rather convoluted, with a great deal of time spent making the red prism. In this case, it was still feasible to manually generate the prism, but what I'm interested in is,
Is there a way to generate a 3D object which is made up of a combination of prisms simply by identifying the vertices at the corner of the object?
If you're interested, my code to allow students to see the three views is as follows, with an example result below.
planviewer =
TableForm@{{"3d", "Side", "Front", "Top"},
{Show[#, ViewPoint -> {1, -1, 1}],
Show[#, ViewPoint -> {∞, 0, 0}],
Show[#, ViewPoint -> {0, -∞, 0}],
Show[#, ViewPoint -> {0, 0, ∞}]},
{"",
Show[#, ViewPoint -> Right],
Show[#, ViewPoint -> Front],
Show[#, ViewPoint -> Above]}} &;
The following code allows them to manipulate the viewpoint dynamically.
Manipulate[
Show[dee, ViewPoint -> {10^a, -(10^b), 10^c}], {a, 0, 3}, {b, 0, 3}, {c, 0, 3}]
View*
functions and what they do, you might find this answer useful. $\endgroup$