JSR-184 Public Review Draft - Apr. 30, 2003.

javax.microedition.m3d
Class TriangleStripArray

java.lang.Object
  |
  +--javax.microedition.m3d.Object3D
        |
        +--javax.microedition.m3d.IndexBuffer
              |
              +--javax.microedition.m3d.TriangleStripArray

public class TriangleStripArray
extends IndexBuffer

TriangleStripArray defines a set of triangle strips. In a triangle strip, the first three vertex indices define the first triangle. Each subsequent index defines a new triangle, along with the two previous indices. For example, the strip S = (2, 0, 1, 4) defines two triangles: (2, 0, 1) and (0, 1, 4).

Triangle strip indices may be explicitly defined, as in the example above, or they may be implicit. In an implicit TriangleStripArray, only the first index of the first strip is specified. All subsequent indices are one greater than their predecessor. For example, if there are two strips with lengths 3 and 4, and the initial index is 10, the strips are formed as follows: S1 = (10, 11, 12) and S2 = (13, 14, 15, 16).

Explicit triangle strips may contain so-called degenerate triangles, that have the same index specified for two or three vertices. Degenerate triangles often result from merging multiple strips into one at content authoring stage. Degenerate triangles are not rendered.

See Also:
Binary format

Field Summary
 
Fields inherited from class javax.microedition.m3d.Object3D
userObject
 
Constructor Summary
TriangleStripArray(int[] indices, int[] stripLengths)
          Constructs a triangle strip array with explicit indices.
TriangleStripArray(int firstIndex, int[] stripLengths)
          Constructs a triangle strip array with implicit indices.
 
Methods inherited from class javax.microedition.m3d.Object3D
addAnimationTrack, animate, clone, find, getAnimationTrack, getAnimationTrackCount, getReferences, getUserID, removeAnimationTrack, setUserID
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TriangleStripArray

public TriangleStripArray(int firstIndex,
                          int[] stripLengths)

Constructs a triangle strip array with implicit indices. The first index of the first strip is specified, along with the lengths of the individual strips.

Parameters:
firstIndex - index of the initial vertex of the first strip
stripLengths - array of per-strip vertex counts to be copied in
Throws:
java.lang.IllegalArgumentException - if stripLengths is empty
java.lang.IllegalArgumentException - if any element in stripLengths is less than 3

TriangleStripArray

public TriangleStripArray(int[] indices,
                          int[] stripLengths)

Constructs a triangle strip array with explicit indices. An array of indices is specified, along with the lengths of the individual strips. The combined length of the strips must not exceed the number of elements in the index array. The contents of both arrays are copied in.

Parameters:
indices - array of indices to be copied in
stripLengths - array of per-strip index counts to be copied in
Throws:
java.lang.IllegalArgumentException - if stripLengths is empty
java.lang.IllegalArgumentException - if any element in stripLengths is less than 3
java.lang.IllegalArgumentException - if any element in indices is negative
java.lang.IllegalArgumentException - if indices.length < sum(stripLengths)

JSR-184 Public Review Draft - Apr. 30, 2003.

Copyright © 2003 Nokia Corporation. See the Copyright Notice for details.