Building Three Dimensional Objects from Primatives

Rather than using the draw and makeObject commands, you can create three-dimensional graphs from primitives. Operation create3Space creates a three-space object to which points, curves, and polygons can be added using the operations from the ThreeSpace domain. The resulting object can then be displayed in a viewport using makeViewport3D. Create the empty three-space object space.

Objects can be sent to this space using the operations exported by the ThreeSpace domain. The following examples place curves into space. Add these three curves to the space.

Create and display the viewport using makeViewport3D. Options may also be given but here are displayed as a list with values enclosed in parentheses.

Cube Example
As a second example of the use of primitives, we generate a cube using a polygon mesh. It is important to use a consistent orientation of the polygons for correct generation of three-dimensional objects. Again start with an empty three-space object.

For convenience, give the DoubleFloat values +1 and -1 names.

Define the vertices of the cube.

Add the faces of the cube as polygons to the space using a consistent orientation.

Create and display the viewport.