m3g04.mesh
Class Teapot

java.lang.Object
  extended by m3g04.mesh.Teapot

public class Teapot
extends java.lang.Object

Creates a new mesh based on the Bezier patches for the Utah Teapot. The teapot data is taken from http://www.sjbaker.org/teapot/ and includes the patches for the teapot's bottom.

Author:
Claus Hoefele
See Also:
Bezier

Field Summary
private static short[] CONTROL_POINTS
          The actual control points of the teapot.
private static int NUMBER_OF_PATCHES
          Number of patches, including reflected ones.
private static short[][] PATCH_DATA
          Defines the Bezier patches for the teapot.
private static int[][] REFLECT_DATA
          Specifies on what axis a patch needs to be reflected.
static float SCALE
          The scale of the vertices in CONTROL_POINTS.
 
Constructor Summary
private Teapot()
          Constructor has private access because class contains static methods exclusively.
 
Method Summary
static javax.microedition.m3g.Mesh create(int steps, boolean addNormals, boolean addTexCoords)
          Creates a new teapot with the given subdivisions in s and t direction.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NUMBER_OF_PATCHES

private static final int NUMBER_OF_PATCHES
Number of patches, including reflected ones.

See Also:
Constant Field Values

SCALE

public static final float SCALE
The scale of the vertices in CONTROL_POINTS.

See Also:
Constant Field Values

REFLECT_DATA

private static final int[][] REFLECT_DATA
Specifies on what axis a patch needs to be reflected. Handle and spout are reflected on the x axis only, all other patches on x, y, and x/y axis. The data must be in the same order as PATCH_DATA.


PATCH_DATA

private static final short[][] PATCH_DATA
Defines the Bezier patches for the teapot. Indices point to vertices in CONTROL_POINTS.


CONTROL_POINTS

private static final short[] CONTROL_POINTS
The actual control points of the teapot. The original data was scaled with the value defined in SCALE.

Constructor Detail

Teapot

private Teapot()
Constructor has private access because class contains static methods exclusively.

Method Detail

create

public static javax.microedition.m3g.Mesh create(int steps,
                                                 boolean addNormals,
                                                 boolean addTexCoords)
Creates a new teapot with the given subdivisions in s and t direction. Minimum values are one for each direction. The teapot is oriented so the lid's knob points in the positive z direction, the spout in the positive x direction, and the center of the teapot's bottom sits at (0, 0, 0).

Parameters:
steps - number of subdivisions.
addNormals - true to generate normals, false otherwise.
addTexCoords - true to generate texture coordinates, false otherwise.
Returns:
teapot mesh.