Contents

Chapters

Sections

j3d.org

[ Previous ] [ Up ] [ Next ]

Types of Geometry

© Justin Couch 1999

Geometry comes in many shapes and sizes. Despite what you might think, it also can be classified into many different forms. There is the traditional polygon or triangle that you are familiar with, but there are also other forms like a 2D image or text. In terms of the way that the scene graph is organised, they are all managed the same and effected by the same sets of attributes.

As you saw in the introductory chapter all geometry is added through the Shape3D class. It must extend the Geometry abstract class. Java 3D classifies geometry under four types:

  1. Geometry arrays
  2. Raster objects
  3. 3d text
  4. Compressed geometry
Geometry in array form is the most common and one that you saw earlier. It expresses polygonal surfaces as points in 3D space and joins them together in a number of different representations.

Raster information is a 2D mapping of image type data. It always stays parallel to the rendered window and is not effected by lighting. In a way, this represents a way of putting 2D text in a 3D window.

3D Text is just what it's name suggests. Pass it a string, font information and some depth information and it will extrude the string into real shapes in a 3D environment.

Finally, compressed geometry is a way of representing a highly optimised form of geometry. Instead of representing every point and connection, compressed geometry only keeps the most important relationships to maintain the basic features. This is really handy when creating extremely complex mesh shapes like faces and body scans.

 

Geometry Arrays

Polygonal data can be expressed in one of three ways: strips, fan and unordered. These describe how you array series of vertices to describe a surface.

In each of the examples shown below, triangles are used as the basic shape. With Java 3D, and most other rendering APIs, it is possible to use more than just triangles. Points, lines and quadrilaterals may also be used.

Your basic unordered collection of geometry is demonstrated in figure 1. Note that each triangle is separate and that they don't share any common edges or vertices. Although they don't typically share information, that is possible. However, if you are, you are probably better off dealing with a different primitive type.

Simple, non-detached triangles
Figure 1: Simple triangles that aren't connected

Strips of vertices combine common edges and vertices together to form a long, connected surface as demonstrated in figure 2. Strips travel in any direction and may make odd turns etc. The area to watch for is that the triangles always form opposing pairs. Note that at each vertex you only ever see three triangles.

Simple, non-detached triangles
Figure 2: Strip of triangles

The last arrangement of geometry is a fan shape. One vertex (usually the first one in the list) provides a pivot point from where all the other vertices then join. Where a triangle strip may be able to cover large distances, the fan is generally reserved for creating conical and flat structures like circles.

Simple, non-detached triangles
Figure 3: A Fan of triangles from a central point

 

Rasters

Rasters are effectively images that are overlaid on the 3D window. Unlike geometry, they don't have a depth and are not effected by the transformation of the geometry as the user moves about. A raster is created from a source image and then passed in as an element of the scene graph.

 

3D Text

3D text creates solid shapes in a similar way that 2D text appears on a page. In reality, this is a shorthand way of creating geometry that looks like text, as internally it is still a very large collection of polygons.

 

Compressed Geometry

Compressed geometry is another way of storing information about polygons. What this does is take a statistical approach to the representation. Where you might need normally 4 bytes to represent a vertex, compressed geometry might only need one and a half. As such, on the outside, it looks exactly the same as a geometry that is in an uncompressed representation, it just takes up a third of the space or less on disk.