3D Theory - Geometry Arrays

This section demonstrates how a geometry is built using an Indexed Face Set (IFS). We dont normally build shapes from scratch like this, there are quicker ways, for instance, we could draw a 2 dimentional shape and then use an 'extrude tool' to turn it into a 3D shape. Or we can build it up from simple pre-built shapes. However building a simple box from scratch will be a good way to understand the underlienig principles of 3D geometrys.

So to begin, start up the program. Then use insert (from the toolbar) to add a TransformGroup, under this add a Shape3D, under this add an IFS and uder this add Coordinate node.

The left hand panel shows this tree structure you have just created.

First add the vertex coordiates, these are the coordinates of the corners of the box, there are 8 coordinated (the 4 corners of the front face and the four corners of the back face).

Select the coordinate node, in the left hand tree panel, in the middle panel click on insert 8 times to give verticies, you should see somthing like this:

Entering vertexes

Now we need to enter the values into the vertex coordinates. Each vertex is a point in space with x,y and z coordinates.

Currenty these are all set to default vaues of zero so we need to enter the numbers.
the vertexes on the front face are:
1.0, -1.0, 1.0,
1.0, 1.0, 1.0,
-1.0, 1.0, 1.0,
-1.0, -1.0, 1.0,
the vertexes on the back face are
-1.0, -1.0, -1.0,
-1.0, 1.0, -1.0,
1.0, 1.0, -1.0,
1.0, -1.0, -1.0,

Enter Vertex coords

The shape (in this case a box) can be made up of triangles or quads (four points in the same plane). As we are building a box, it is probably easier to use quads. So we need six rectangles to make up the box. Six rectangular faces are needed, top, bottom, left, right, front and back. Each of which is defined by its four corners.

0,1,2,3, // front face
4,5,6,7, // back face
7,6,1,0, // right face
3,2,5,4, // left face
1,6,5,2, // top face
3,4,7,0, // bottom face




new sfvec3f( 0.0f, 0.0f, 1.0f), // front face
new sfvec3f( 0.0f, 0.0f, -1.0f), // back face
new sfvec3f( 1.0f, 0.0f, 0.0f), // right face
new sfvec3f(-1.0f, 0.0f, 0.0f), // left face
new sfvec3f( 0.0f, 1.0f, 0.0f), // top face
new sfvec3f( 0.0f, -1.0f, 0.0f), // bottom face

metadata block
see also:


Correspondence about this page

Book Shop - Further reading.

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.

cover Curves and Surfaces in Geometric Modeling: Theory and Algorithms

Commercial Software Shop

Where I can, I have put links to Amazon for commercial software, not directly related to this site, but related to the subject being discussed, click on the appropriate country flag to get more details of the software or to buy it from them.


cover Dark Basic Professional Edition - It is better to get this professional edition

cover This is a version of basic designed for building games, for example to rotate a cube you might do the following:
make object cube 1,100
for x=1 to 360
rotate object 1,x,x,0
next x

cover Game Programming with Darkbasic - book for above software

This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2015 Martin John Baker - All rights reserved - privacy policy.