Polyhedral Playground

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram CDF Player or other Wolfram Language products.

Requires a Wolfram Notebook System

Edit on desktop, mobile and cloud with any Wolfram Language product.

This Demonstration lets you play with 3D polygonal structures and objects and create your own designs. You can manipulate vertices, edges, faces, and objects using a wide variety of move types and actions. You can deform, stretch, pull, push, join, and separate faces and objects.

[more]

Twenty-five sample projects give you some hints of what you can do.

[less]

Contributed by: Karl Scherer (July 2013)
Open content licensed under CC BY-NC-SA


Snapshots


Details

Introduction

A project is a collection of objects. Each object is simply a connected 2D or 3D polygonal structure (such as a cube), consisting of colored faces (polygons). Each face is defined by a list of different vertices (points) and a color. As in the case of the cube (which is defined by eight vertices), faces can share points, so that moving a vertex deforms the object. This makes manipulating your polygonal structures very easy.

The system will calculate the connected components (objects) of your project automatically (see action "1 rnd color per obj", details below). Click button "h1" to highlight the current object (its vertices will turn green). Click again to switch it off.

There are no solitary vertices or edges in this toolbox. If you need a solitary vertex, create a triangle where two vertices are nearly identical.

A special treat in this Demonstration is the move types "pull vertex v1 (rubber)", "pull vertex v1 (honey)", "pull vertex v1 (liquid)". They simulate pulling a vertex that dynamically stretches the currently edited object as if it were rubber/honey/liquid.

Controls

project

A project is the 3D design you are currently working on.

You can select the project via the popup menu or the navigation setter bar ("<<","<",">",">>").

Click "+" to store your creation as a new, additional project.

plot range

This slider lets you increase the plot range.

"save/restore/add/reset" setter bar

Here you can save and restore your project, add a stored project to an existing one or reset it to default values. Note that you can copy across different projects! E.g., you can "save" a creation in project 1, then "add" it in project 3. Hence you can develop parts of a project under different project numbers and only later bring them together.

"drop" popup menu (add an object)

With the "(drop)" popup menu you can select several basic objects (such as a cube, a square, or a pyramid) to add to your project. Some are abbreviated (e.g., dodecah. = dodecahedron). You can also add whole projects to your current project; see below.

X

The "O/v1/v2/fc/oc/mk/X" popup menu determines where the new object is put: at the origin ("O"), vertex "v1", vertex "v2", the face center ("fc"), the object center ("oc"), or the special marked position ("mk"), shown as a blue arrow. Click "X" to drop at the origin while replacing the existing project.

r

Click the toggle "r" at the right to repeat the last object drop.

h1/h2 (highlight current object)

Click the toggle "h1" to highlight the current object by painting all its vertices green and its faces yellow. Click it again to switch it off. Note that this object-specific highlighting is NOT automatically updated if you leave it active (it is updated when a different face selected, though). Any action will deselect h1 and h2. Therefore, please use it only when you need it.

Click "h2" to limit the display to the current object. Exercise: select project 14 and click "h2".

face

Select the face (polygon) you want to work with. You can select the face via the popup menu or the navigation setter bar ("<<","<",">",">>"). Click the display checkboxes next to it to highlight it (see below). Selecting vertex "v1" (see further down) will cause the system to find a face that contains this vertex.

face display checkboxes

Click the first checkbox to the right to highlight the selected face: it will have a yellow color and will have its vertices colored as thick yellow points. The current vertex v1 will be a red point.

Click the second checkbox to display the numbers of the vertices of the current face.

The next row shows the vertex associated with the selected face (the first ten entries).

(mirror) popup menu

For the mirroring of the , , and coordinates, the mirror planes are positioned at the marker (blue arrow)!

"vertex v1 (x)" mirrors v1 at the - plane positioned at the marker (blue arrow); similarly for "vertex v1 (y)" and "vertex v1 (z)".

"vertex v1 (mk)" point-mirrors v1 at the marker.

"vertex v2 (face)" mirrors v2 (!) at the current face plane.

Similarly, there are five mirror operations for objects.

face color selection

Select a face color by using the swatch or click the "r" button to have the system select a random color.

Click "s" to store the color; click "c" to restore the stored color.

(display) popup menu

The selections in this menu apply to the whole project.

Clicking "vertex size -" reduces the size of the dots that mark the vertices; "vertex size +" increases the size.

Click "vn offset .5", "vn offset .2", "vn offset .1", "vn offset 0", to set the offset for displaying the vertex numbers.

Options "no edges", "thin edges", and "thick edges" give you three thicknesses of the lines.

"show" checkboxes

The first "show" checkbox displays all vertices (as black points). The second checkbox displays the numbers of the vertices. The third displays the face numbers (purple, bold font). Use this third checkbox only intermittently, since the face numbers are not automatically updated (for performance reasons) when you amend your project. Note that there are special buttons ("h1","h2") that highlight the current object.

opacity

The opacity slider controls the transparency of the current face. Note that the opacity can be different for each face!

Clicking "obj" will set the opacity for all faces of the current object at the same time.

Clicking "*" will set the opacity for all faces of your project.

"v1" and "v2" vertex popup menus

Here you can select two vertices (called "v1" and "v2") that may be used by one of the "actions" or in connection with the move sliders (see below). Vertex v1 has to belong to the currently edited face (polygon) of your object. If you choose a vertex number that does not belong to the current face, the system will automatically find a face that includes vertex v1.

"v1" and "v2" marker buttons to the left of the popup menus

Click the "v1" button to set the blue position marker to v1; similar for "v2". Various actions and some move types use the marked position.

V1 and v2 have their coordinates displayed next to them. Also, the distance between v1 and v2 is displayed.

Buttons "+" and "-" (next to "v2") are the let's-make-a-new-face-buttons

Clicking "+" will add the vertex v2 to the set of vertex numbers for an additional face. This set is displayed in the next row, and on the graphics board the vertices are colored blue (switch off the highlight button to the right of the face selection). When you have added at least three vertices, you can bring the associated face to life with the action "make '+' face". Click "-" to delete the last vertex in the selection. You can delete the whole selection with the action "scratch '+' face".

Actions

"mark v1" sets the special position marker (large blue point) to vertex v1 (clicking v1 has the same result).

"mark v2" sets the special position marker (large blue point) to vertex v2 (clicking v2 has the same result).

"mark origin" sets the special position marker (large blue point) to {0,0,0}. Note that the marker is NOT part of any face.

"mark midpoint v1,mk" sets the special position marker (large blue point) to the point halfway between v1 and the old marked position (which is at the origin {0,0,0} at the start). Note that no new vertex is created by this action. To mark the midpoint between v1 and v2, mark the vertex v2 first by clicking the "v2" button first.

"mark face center" moves the special position marker to the center of the current face. The face center is calculated as the sum of all vectors to its vertices divided by the number of vertices. Note that no new vertex is created by this action. (Compare this to "create face center" below).

"mark object center" moves the special position marker to the center of the current object. The object center is calculated as the sum of all vectors to its vertices divided by the number of vertices. Note that no new vertex is created by this action.

"move vertex v1 to marker" moves the vertex v1 to the position given by the large blue marker.

"move face to marker" moves the face such that the face center ends up at the position given by the large blue marker.

"move face (v1) to marker" moves the face such that the vertex v1 ends up at the position given by the large blue marker.

"move obj to marker" moves the object such that the object's center ends up at the position given by the large blue marker.

"move object (v1) to marker" moves the current object such that the vertex v1 ends up at the position given by the large blue marker.

"create midpoint v1,next" creates a new vertex halfway between vertex v1 and the next vertex of the current face.

"create face center" cuts the face into many triangles. The cuts run from each vertex to the face center.

"intersect two lines" points the position marker (green arrow) to the intersection of the lines through p1 and p2 with the line through p3 and p4, where p1, p2, p3, p4 are the first entries in the "new face" vertex collection, which is created using the "+" button next to v2 and is displayed underneath it. The system assumes , so the marker will point to a position in the () plane. The system will also create a new triangular face: {p1, p2, marker}.

"split vertex v1" replaces v1 by new vertices for each face that contains v1 (except in the current face). Joint objects and faces can thus be separated.

"combine vertices at v1" replaces all vertices that are at the same position as vertex "v1" by "v1", thereby reducing the number of vertices and maybe joining faces that were disjoint before (use action "split vertex v1" to reverse this action). Also, this action deletes any double quotes of vertices: it will turn face {4,1,1,6} into {4,1,6}.

"combine all vertices" replaces all vertices that are at the same position by one vertex, thereby reducing the number of vertices and maybe joining faces that were disjoint before. Also, this action deletes any double quotes of vertices: it will turn face {4,1,1,6} into {4,1,6}.

"combine-tolerance .01" relates to the two previous actions and means that only vertices are combined that are closer than 0.01 .

"combine-tolerance .1" relates to the two previous actions and means that only vertices are combined that are closer than 0.1 .

"combine-tolerance 1" relates to the two previous actions and means that only vertices are combined that are closer than 1.0 .

"split face" cuts the current face into two faces by adding the edge from v1 to v2. The vertices v1 and v2 must not be adjacent.

"double face" creates a copy of the current face, placed at the same position. No new vertices are created.

"make '+' face" uses the vertices selected with the '+v2' button next to the popup menus for v1 and v2, and displays them as a new colored face.

"scratch '+' face" deletes the selection of vertices created with the '+' button.

"given color at v1" colors all faces that contain vertex v1 with the given color.

"monochrome object" colors all faces of the object with the same given color.

"rnd color object" colors each face of the current object with a random, different color.

"1 rnd color per obj" paints each object in a (random) monochrome color.

"rnd color all" randomly colors all faces.

"monochrome all" paints all faces with the same given color.

"keep only triangles" deletes all faces except triangles.

"keep faces of degree 3 or 4" deletes all faces apart from triangles and quadrilaterals.

"keep only quads" deletes all faces apart from quadrilaterals.

"keep faces of deg > 4" leaves only faces with at least 5 vertices.

"blend 2 face colors" takes the current face and finds the face furthest away from it. The colors of these two faces are then blended to determine colors for all other faces, depending how far away they are from the two far-apart faces.

"snap vertex v1" snaps the coordinates of v1 to the orthogonal or the isometric (60°) grid.

"snap face" snaps the vertices of current face to the orthogonal or the isometric (60°) grid.

"snap component" snaps the vertices of current component to the orthogonal or the isometric (60°) grid.

"snap project" snaps all vertices to the orthogonal or the isometric (60°) grid.

Note that in z-direction the two grids share the same values.

"extrude face v1->mk" extrudes the current face such that vertex v1 will end up at the marked position (blue arrow).

"r" (action repeat button)

Click it to repeat the last action.

create/delete setter bar (+vertex/+face/+object/-v/-f/-o)

"+vertex" places a new vertex halfway between vertex v1 and the next vertex of the current face.

"+face" and "+object" create a copy of the current face or object at the original position, without any connection to existing faces or objects.

Buttons "-v", "-f", "-o" delete the current vertex/face/object respectively. "-v" deletes vertex v1, but only if every resulting face has at least three vertices. The last face of your project cannot be deleted.

move type (slider controls)

The popup menu "move type" determines the use of the x, y, and z sliders. For move types in parentheses, such as "(move v1, v2 vertically)", only the x slider is active (in these cases the "x slider" is just a name, and does not control the coordinate)!

"move vertex v1 -> x,y,z" lets you reposition the vertex v1 with the x-, y- and z-sliders.

"(move vertex v1 to marker)" moves vertex v1 along the line from the given vertex v1 to the blue marker. Only the first slider of the three sliders is active in this case!

"move v1 vertically" lets vertex v1 move perpendicularly to the face it belongs to.

"position marker" lets you set the , , and coordinates of the special position (marked by a blue arrow with a blue point) that is used by many actions and move types.

"move face -> x,y,z" lets you reposition the current face with the x-, y- and z-sliders.

"(move face to marker)" moves the face such that the face center ends up at the marked position. Only the first slider of the three sliders is active in this case!

"(move face v1 -> mk)" moves the face such that v1 moves to the marker (blue arrow with a blue point). Only the first slider of the three sliders is active in this case!

"move face vertically" moves the face vertically to its surface. Only the first slider of the three sliders is active in this case!

"move object -> x,y,z" lets you reposition the current object with the x-, y- and z-sliders.

"(move object to marker)" moves the object such that the object center ends up at the marked position. Only the first slider of the three sliders is active in this case!

"(move object v1 -> mk)" moves the object such that v1 moves to the marker (blue arrow with a blue point). Only the first slider of the three sliders is active in this case!

"(move object vertically)" moves the object vertically to the current face. Only the first slider of the three sliders is active in this case!

"move all -> x,y,z" lets you reposition all objects at once.

"pull vertex v1 (rubber)", "pull vertex v1 (honey)", "pull vertex v1 (liquid)", let you pull vertex v1 so that the whole current object is stretched as if it were rubber/honey/liquid. The vertex furthest away from v1 stays unchanged. If you move a slider to the left, a push is accomplished instead of a pull, which creates additional effects.

"(new vertex on v1, mk)" creates a new vertex (of the current face) placed on the line from v1 to the position marker (large blue point). To create a point between v1 and v2, set the marker to v2 by clicking the "v2" button first.

"rotate vertex v1" rotates vertex v1 around the , , and axes.

"rotate marker" rotates the blue marker around the , , and axes.

"rotate face around x,y,z (mk)" rotates the face around the x-,y-,z-axis through the marked position (blue arrow), which may be set to the object center, the face center, or v1 or v2, for example.

"(rotate face around v1-mk)" rotates the face around the line v1-mk, where v1 is the first selected vertex and mk is the position marked with a blue dot. Only the first slider of the three sliders is active in this case!

"(rotate face in its plane (mk))" rotates the face in its own plane. The axis of rotation is the (imaginary) vertical line dropped from the marker (blue dot) onto the face plane.

"rotate object around x,y,z (mk)" rotates the object around the x-,y-,z-axis through the marked position (blue arrow), which may be set to the object center, the face center, or v1 or v2, for example.

"(rotate object v1-mk)" rotates the object around the line v1-mk, where v1 is the first selected vertex and mk is the position marked with a blue dot. Only the first slider of the three sliders is active in this case!

"(rot obj in face plane (mk))" rotates the object in the plane of the current face. The axis of rotation is the (imaginary) vertical line dropped from the marker (blue dot) onto the face plane.

"rotate all (mk)" rotates all objects at once around the marked position (blue point).

"(resize distance v1-v2)" resizes the (imaginary) edge that connects v1 and v2. Note that v1 and v2 do not have to belong to the same face.

"(resize face (mk))" changes the distances between the face's vertices and the marked position (blue arrow).

"resize face x, y, z (mk)" resizes the current face (relative to the marked position (blue arrow)) in the , , and direction as given.

"(resize odd vertices (mk))" resizes the distances between a face's odd-numbered vertices and the marked position (blue arrow).

"(resize object (mk))" changes the distances between the object's vertices and the marked position (blue arrow).

"resize object x, y, z (mk)" resizes the extents of the current object (relative to the marked position) in the , , and direction as given.

"(resize all (mk))" changes all the distances between the vertices and the marked position (blue arrow).

"(extrude face)" extrudes a 3D prism (open at the back) from the current face, vertical to the face. Only the first slider of the three sliders is active in this case! Use move type "move face" to change the direction of the extrusion afterward.

"(extrude face closed)" creates an extrusion with a closed back face.

"cut away at v1" cuts off vertex v1 like a grinding stone cuts a diamond. Only the first slider of the three sliders is active in this case. Warning: save your project first before using this move type, because for technical reasons you CANNOT go back to the slider position you started with! The grinding is proportional: after shifting the slider 10 units, the neighboring vertices of v1 are all reached at the same time. Use "combine vertices at v1" on all vertices after the cutting to eliminate double vertices.

"cut equally at v1" works similarly to "cut away at v1", but here the grinding progress is equal for all edges involved. Hence not all neighboring vertices might be reached at the same time.

Move the sliders to execute the movements.

"r" (recall previous move type)

For technical reasons, the move type selection is deleted after it has been used. Click the repeat button "r" to the right of the move type popup menu to recall the previous move type.

"-/+" (incremental slider changes)

If a move type with rotation is selected (or if no move type is selected), the slider ranges are set to {-180°, 180°}; otherwise they are {-10,10}.

Clicking the (-/+) setter bar incrementally changes the slider settings. Click "-" to decrease the slider setting by 1.0, click "+" to increase it by one unit. For rotations the increments are 10°.

Click the small '+' signs next to the sliders to key in a rotation amount manually.

"d/0//-/+" (other slider controls)

Click "d" to reset the slider ranges to default values.

Click "0" to set all slider values to zero .

The range of the sliders (which is (-10,10) at the start) can be changed with the "<", ">" controls. Clicking ">" doubles the range; clicking "<" halves them. For the rotation move types, the range is (-360,360), and the <", ">" control buttons work the same way.

Click "-" to halve the slide increments; click "+" to double the slider increments (defaults are 1.0 for movements and 10° for rotations).

The current range and the current increment size are displayed in the same row.

face sequence "0/-/+current/J/J2" setter bar

Each time you create an additional face by clicking "+face" (see above), the number of the original face (not of its new copy) is stored in a special "face storage".

Click "0" to empty the face storage.

Click "-" to delete the last entry in the face storage.

Click "+current" to add the number of the current face to the face storage. Note: if you are creating snapshots of a face being rotated or moved, use button "+face" instead of "face sequence+", because "face sequence+" does not create any new face. Using face sequence+ several times for the same face just creates duplicate storage entries.

Click "J" to join all stored faces (each face having the same number of vertices, for best effect).

Click "J2" to join all stored faces, and also join the last one to the first. If you have several faces that are rotations of the same face, you can create a rotational object using "J2".

Other controls

There are also display controls for marker, axes, grid, and background color.

The "marker" toggle controls whether the special blue pointer (blue arrow with large blue point) is being displayed (for details see "actions" above).

The grid control consists of a ON/OFF toggle and a "60 / 90" drop-down menu, where "90" denotes a right-angled grid, "60" denotes an isometric (60°) grid. Note that in z-direction the two grids are the same. The "snap" actions work even when no grid is displayed.

Errors, warnings, and hints

In the last row, error messages, warnings, and hints are displayed, if necessary.

Exercise 1: Create a four-sided pyramid from a square

Select project 2 (simple square). Use action "double face" to double the square. Now select action "create face center" to create four triangles. Set v1=5. With move type "move vertex" selected, move the z slider. You have created a four-sided pyramid with a bottom face.

Exercise 2: How to rotate a cube around the axis that goes through the centers of two opposite sides

We start with a cube that has an arbitrary orientation in space. Select one face (say face "1"), select action "create face center", then do the same for the opposite face (face "2"). Now select the new centers to be v1 and v2. Mark v2 by clicking the "v2" button. Finally select move type "(rotate object v1-mk)". Move the top slider to see the rotation.

Exercise 3: We create the object shown in project 8

Create the truncated cube in project 6 from a cube by grinding the eight corners off with the move type "cut equally at v1" (next to the x slider, click "+" twice to set the slider to 2; select the next corner for v1; reselect the cutting move type by clicking "r" and so on). Afterward, eliminate double vertices by welding them together by applying the action "combine all vertices".

Now either extrude all triangles on the truncated cube to volumes with the move type "extrude face" to get the structure of project 7, or use action "mark face center" and move type "(resize face (mk))" for each triangle to create project 8.

Exercise 4: We build a staircase

Drop "zig zag". Select v1=7. Action "create midpoint". Select move type "move vertex v1". Move y slider to -3. Select move type "(extrude face closed)". Move x slider to 6.

Exercise 5: We create project 17

Drop "8-star". Select action "mark origin" (or "mark face center" or "mark object center"). Select move type "resize odd vertices (mk)". Move the x slider to the left (negative). You have created one of the nice stars that make up project 17.

Hints

Use the "save" option often!

The Mathematica graphics often cannot deal well with negative sizes of polygon edges. Hence during resizing it is advisable to keep the move slider values positive.

If you resize a face to size zero, you should then delete this face. A vertex should appear only once in a face.

If you want to rotate an object around its center, select action "mark object center" before you select move type "rotate object (mk)". Note that there does not have to be a vertex at the center.

To glue faces and objects together, use the action "combine vertices at v1" for each contacting vertex "v1" or use action "combine all vertices".

FAQ

Q: How do I measure a distance between two vertices v1 and v2 in this Demonstration?

A: The distance between v1 and v2 is displayed to the right of v1.

Q: How can I turn a polygonal face into a set of triangles?

A: Select vertices v1 and v2 so that they have a common neighboring vertex, then use the action "split face". This will transform the current face into a triangle and a remainder face with one less vertex.

Q: How can I find out how many (mutually disjoint) objects there are in a project?

A: Save your project first by clicking "save". Then select action "1 rnd color per object" to color each object in with a different color. A message will appear at the bottom left telling you how many objects there are. Finally click "restore" to get the original coloring back.

Q: How can I extrude a wall from a polyline?

A: Let's say your polyline is a zigzag line. Start with a polygon (face) that contains your polyline, such as given in the drop option "zig zag". Select move type "(extrude face)", move the x slider, then delete the surplus faces. Project 16 shows the result.

Q: What is the easiest way to make an extrusion that is a separate object?

A: Click the "+face" button first, then select move type "(extrude face closed)". Move the top slider.

Q: How is project 21 produced?

A: Drop a sphere. Select v1=5 (this is the "north pole"). Select move type "pull vertex v1 (honey)" and move the z slider to the left (negative value). Color with action "rnd color object".



Feedback (field required)
Email (field required) Name
Occupation Organization
Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback.
Send