ContentsPreviousNext

Java 3D API Specification

C H A P T E R7

Node Component Objects
 
 
 

NODE component objects include the actual geometry and appearance attributes used to render the geometry.

7.1 Node Component Objects: Attributes

Node objects by themselves do not fully specify their exact semantics. They contain information that further refines their exact meaning. Some of that information is specified as an attribute and an associated floating-point or integer value. In many cases, however, the information consists of references to more complex entities called node component objects. Node component objects encapsulate related state information in a single entity. See Figure 7-1.

7.1.1 Appearance Object

The Appearance object is a component object of a Shape3D node that defines all rendering state attributes for that shape node. If the Appearance object in a Shape3D node is null, default values will be used for all rendering state attributes.

Constants
The Appearance component object defines the following flags.
public static final int ALLOW_MATERIAL_READ
public static final int ALLOW_MATERIAL_WRITE
public static final int ALLOW_TEXTURE_READ
public static final int ALLOW_TEXTURE_WRITE
public static final int ALLOW_TEXGEN_READ
public static final int ALLOW_TEXGEN_WRITE
public static final int ALLOW_TEXTURE_ATTRIBUTES_READ

public static final int ALLOW_TEXTURE_ATTRIBUTES_WRITE
public static final int ALLOW_COLORING_ATTRIBUTES_READ
public static final int ALLOW_COLORING_ATTRIBUTES_WRITE
public static final int ALLOW_TRANSPARENCY_ATTRIBUTES_READ
public static final int ALLOW_TRANSPARENCY_ATTRIBUTES_WRITE
public static final int ALLOW_RENDERING_ATTRIBUTES_READ
public static final int ALLOW_RENDERING_ATTRIBUTES_WRITE
public static final int ALLOW_POLYGON_ATTRIBUTES_READ
public static final int ALLOW_POLYGON_ATTRIBUTES_WRITE
public static final int ALLOW_LINE_ATTRIBUTES_READ
public static final int ALLOW_LINE_ATTRIBUTES_WRITE
public static final int ALLOW_POINT_ATTRIBUTES_READ
public static final int ALLOW_POINT_ATTRIBUTES_WRITE
These flags, when enabled using the setCapability method, allow an application to invoke methods that read and write the specified component object reference (material, texture, texture coordinate generation, and so forth). These capability flags are enforced only when the object is part of a live or compiled scene graph.

Constructors
The Appearance object has the following constructor.
public Appearance()
Constructs and initializes an Appearance object using defaults for all state variables. All component object references are initialized to null.

Methods
The Appearance object has the following methods.
public final void setMaterial(Material material)
public final Material getMaterial()
The Material object specifies the desired material properties used for lighting. Setting it to null disables lighting.
public final void setTexture(Texture texture)
public final Texture getTexture()
The Texture object specifies the desired texture map and texture parameters. Setting it to null disables texture mapping.
public final void setTextureAttributes(TextureAttributes 
       textureAttributes)
public final TextureAttributes getTextureAttributes()
These methods set and retrieve the TextureAttributes object. Setting it to null results in default attribute use.
public final void setColoringAttributes(ColoringAttributes 
       coloringAttributes)
public final ColoringAttributes getColoringAttributes()
These methods set and retrieve the ColoringAttributes object. Setting it to null results in default attribute use.
public final void setTransparencyAttributes(
       TransparencyAttributes transparencyAttributes)
public final TransparencyAttributes getTransparencyAttributes()
These methods set and retrieve the TransparencyAttributes object. Setting it to null results in default attribute use.
public final void setRenderingAttributes(RenderingAttributes 
       renderingAttributes)
public final RenderingAttributes getRenderingAttributes()
These methods set and retrieve the RenderingAttributes object. Setting it to null results in default attribute use.
public final void setPolygonAttributes(PolygonAttributes 
       polygonAttributes)
public final PolygonAttributes getPolygonAttributes()
These methods set and retrieve the PolygonAttributes object. Setting it to null results in default attribute use.
public final void setLineAttributes(LineAttributes lineAttributes)
public final LineAttributes getLineAttributes()
These methods set and retrieve the LineAttributes object. Setting it to null results in default attribute use.
public final void setPointAttributes(PointAttributes 
       pointAttributes)
public final PointAttributes getPointAttributes()
These methods set and retrieve the PointAttributes object. Setting it to null results in default attribute use.
public final void setTexCoordGeneration(TexCoordGeneration 
       texCoordGeneration)
public final TexCoordGeneration getTexCoordGeneration()
These methods set and retrieve the TexCoordGeneration object. Setting it to null disables texture coordinate generation.
public NodeComponent cloneNodeComponent()
This method creates a new Appearance object. The method is called from a leaf node's duplicateNode method.
public void duplicateNodeComponent(NodeComponent originalNode)
This method copies the information found in originalNode to the current node. This routine is called as part of the cloneTree operation.

7.1.2 ColoringAttributes Object

The ColoringAttributes object defines attributes that apply to color mapping.

Constants
public static final int ALLOW_COLOR_READ
public static final int ALLOW_COLOR_WRITE
public static final int ALLOW_SHADE_MODEL_READ
public static final int ALLOW_SHADE_MODEL_WRITE
These flags, when enabled using the setCapability method, allow an application to invoke methods that respectively read and write its color component and shade model component information.

Constructors
public ColoringAttributes()
Constructs a ColoringAttributes node with default parameters:

Parameter Default Value
color white (1,1,1)
shadeModel SHADE_GOURAUD

public ColoringAttributes(Color3f color, int shadeModel)
public ColoringAttributes(float red, float green, float blue, 
       int  shadeModel)
These constructors create a ColoringAttributes object with the specified values.

Methods
public final void setColor(Color3f color)
public final void setColor(float r, float g, float b)
public final void getColor(Color3f color)
These methods set and retrieve the intrinsic color of this ColoringAttributes component object. This color is used when lighting is disabled or when the Material is null.
public final void setShadeModel(int shadeModel)
public final int getShadeModel()
These methods set and retrieve the shade model for this ColoringAttributes component object. The shade model is one of the following:
public NodeComponent cloneNodeComponent()
This method creates a new ColoringAttributes object. This method is called from a leaf node's duplicateNode method.
public void duplicateNodeComponent(NodeComponent originalNode)
This method copies the information found in originalNode to the current node. This method is called as part of the cloneTree operation.

7.1.3 LineAttributes Object

The LineAttributes object defines attributes that apply to line primitives.

Constants
The LineAttributes object specifies the following variables.
public static final int ALLOW_WIDTH_READ
public static final int ALLOW_WIDTH_WRITE
public static final int ALLOW_PATTERN_READ
public static final int ALLOW_PATTERN_WRITE
public static final int ALLOW_ANTIALIASING_READ
public static final int ALLOW_ANTIALIASING_WRITE
These flags, when enabled using the setCapability method, allow an application to invoke methods that read and write its individual component field information.
public static final int PATTERN_SOLID
Draws a solid line with no pattern.
public static final int PATTERN_DASH
Draws a dashed line. Ideally, this will be drawn with a repeating pattern of eight pixels on and eight pixels off.
public static final int PATTERN_DOT
Draws a dotted line. Ideally, this will be drawn with a repeating pattern of one pixel on and seven pixels off.
public static final int PATTERN_DASH_DOT
Draws a dashed-dotted line. Ideally, this will be drawn with a repeating pattern of seven pixels on, four pixels off, one pixel on, and four pixels off.

Constructors
public LineAttributes()
Constructs a LineAttributes object with default parameters:

Parameter Default Value
lineWidth 1
linePattern PATTERN_SOLID
lineAntialiasing false

public LineAttributes(float lineWidth, int linePattern, 
       boolean  lineAntialiasing)
Constructs a LineAttributes object with specified values of line width, pattern, and whether antialiasing is enabled or disabled.

Methods
public final void setLineWidth(float lineWidth)
public final float getLineWidth()
These methods respectively set and retrieve the line width, in pixels, for this LineAttributes component object.
public final void setLinePattern(int linePattern)
public final int getLinePattern()
These methods respectively set and retrieve the line pattern for this LineAttributes component object. The linePattern value describes the line pattern to be used, which is one of the following: PATTERN_SOLID, PATTERN_DASH, PATTERN_DOT, or PATTERN_DASH_DOT.
public final void setLineAntialiasingEnable(boolean state)
public final boolean getLineAntialiasingEnable()
The set method enables or disables line antialiasing for this LineAttributes component object. The get method retrieves the state of the line antialiasing flag. The flag is true if line antialiasing is enabled, false if line antialiasing is disabled.
public NodeComponent cloneNodeComponent()
public void duplicateNodeComponent(NodeComponent originalNode)
The first method creates a new LineAttributes object; this method is called from a leaf node's duplicateNode method. The second method copies the information found in originalNode to the current node; this method is called as part of the cloneTree operation.

7.1.4 PointAttributes Object

The PointAttributes object defines attributes that apply to point primitives.

Constants
The PointAttributes object specifies the following variables.
public final static int ALLOW_SIZE_READ
public final static int ALLOW_SIZE_WRITE
public final static int ALLOW_ANTIALIASING_READ
public final static int ALLOW_ANTIALIASING_WRITE
These flags, when enabled using the setCapability method, allow an application to invoke methods that read and write its individual component field information.

Constructors
public PointAttributes()
Constructs a PointAttributes object with default parameters:
 
Parameter Default Value
pointSize 1
pointAntialiasing false
public PointAttributes(float  pointSize, 
       boolean  pointAntialiasing)
Constructs a PointAttributes object with specified values.

Methods
public final void setPointSize(float pointSize)
public final float getPointSize()
These methods set and retrieve the point size, in pixels, for this Appearance component object.
public final void setPointAntialiasingEnable(boolean state)
public final boolean getPointAntialiasingEnable()
The set method enables or disables point antialiasing for this PointAttributes component object. The get method retrieves the state of the point antialiasing flag. The flag is true if point antialiasing is enabled, false if point antialiasing is disabled.
public NodeComponent cloneNodeComponent()
public void duplicateNodeComponent(NodeComponent originalNode)
The first method creates a new PointAttributes object; this method is called from a leaf node's duplicateNode method. The second method copies the information found in originalNode to the current node; this method is called as part of the cloneTree operation.

7.1.5 PolygonAttributes Object

The PolygonAttributes object defines attributes that apply to polygon primitives.

Constants
The PolygonAttributes object specifies the following variables.
public final static int ALLOW_CULL_FACE_READ
public final static int ALLOW_CULL_FACE_WRITE
public final static int ALLOW_MODE_READ
public final static int ALLOW_MODE_WRITE
public final static int ALLOW_OFFSET_READ
public final static int ALLOW_OFFSET_WRITE
public static final int ALLOW_NORMAL_FLIP_READ
public static final int ALLOW_NORMAL_FLIP_WRITE
These flags, when enabled using the setCapability method, allow an application to invoke methods that read and write its individual component field information.

Constructors
public PolygonAttributes()
Constructs a PolygonAttributes object with default parameters:

Parameter Default Value
cullFace CULL_BACK
backFaceNormalFlip false
polygonMode POLYGON_FILL
polygonOffset 0.0

public PolygonAttributes(int polygonMode, int cullFace, 
       float  polygonOffset)
public PolygonAttributes(int polygonMode, int cullFace, float 
       polygonOffset, boolean backFaceNormalFlip)
These constructors create a new PolygonAttributes object.

Methods
public final void setCullFace(int cullFace)
public final int getCullFace()
These methods set and retrieve the face culling flag for this PolygonAttributes component object. The face culling flag is one of the following:
public final void setPolygonMode(int polygonMode)
public final int getPolygonMode()
These methods set and retrieve the polygon rasterization mode for this Appearance component object. The polygon rasterization mode is one of the following:
public final void setPolygonOffset(float polygonOffset)
public final float getPolygonOffset()
These methods set and retrieve the polygon offset. This screen-space offset is added to the final, device-coordinate Z value of polygon primitives.
public final void setBackFaceNormalFlip(boolean 
       backFaceNormalFlip)
public final boolean getBackFaceNormalFlip()
These methods set and retrieve the back-face normal flip flag. This flag indicates whether vertex normals of back-facing polygons should be flipped (negated) prior to lighting. When this flag is set to true and back-face culling is disabled, polygons are rendered as if the polygon had two sides with opposing normals. This feature is disabled by default.
public NodeComponent cloneNodeComponent()
public void duplicateNodeComponent(NodeComponent originalNode)
The first method creates a new PolygonAttributes object; this method is called from a leaf node's duplicateNode method. The second method copies the information found in originalNode to the current node; this method is called as part of the cloneTree operation.

7.1.6 RenderingAttributes Object

The RenderingAttributes object defines per-pixel rendering state attributes common to all primitive types.

Constants
public static final int ALLOW_ALPHA_TEST_VALUE_READ
public static final int ALLOW_ALPHA_TEST_VALUE_WRITE
public static final int ALLOW_ALPHA_TEST_FUNCTION_READ
public static final int ALLOW_ALPHA_TEST_FUNCTION_WRITE
public static final int ALLOW_DEPTH_ENABLE_READ
These flags, when enabled using the setCapability method, allow an application to invoke methods that respectively read and write its individual test value and function information.

Constructors
public RenderingAttributes()
Constructs a RenderingAttributes object with default parameters:
 
Parameter Default Value
depthBufferEnable true
depthBufferWriteEnable true
alphaTestFunction ALWAYS
alphaTestValue 0.0
public RenderingAttributes(boolean depthBufferEnable, 
       boolean  depthBufferWriteEnable, float alphaTestValue, 
       int  alphaTestFunction)
Constructs a RenderingAttributes object with specified values.

Methods
public final void setDepthBufferEnable(boolean state)
public final boolean getDepthBufferEnable()
These methods set and retrieve the depth buffer enable flag for this RenderingAttributes component object. The flag is true if the depth buffer mode is enabled, false if disabled.
public final void setDepthBufferWriteEnable(boolean state)
public final boolean getDepthBufferWriteEnable()
These methods set and retrieve the depth buffer write enable flag for this RenderAttributes component object. The flag is true if the depth buffer mode is writable, false if the depth buffer is read-only.
public final void setAlphaTestValue(float value)
public final float getAlphaTestValue()
These methods set and retrieve the alpha test value used by the alpha test function. This value is compared to the alpha value of each rendered pixel.
public final void setAlphaTestFunction(int function)
public final int getAlphaTestFunction()
These methods set and retrieve the alpha test function. The alpha test function is one of the following:
public NodeComponent cloneNodeComponent()
public void duplicateNodeComponent(NodeComponent originalNode)
The first method creates a new RenderingAttributes object; this method is called from a leaf node's duplicateNode method. The second method copies the information found in originalNode to the current node; this method is called as part of the cloneTree operation.

7.1.7 TextureAttributes Object

The TextureAttributes object defines attributes that apply to texture mapping.

Constants
public static final int ALLOW_MODE_READ
public static final int ALLOW_MODE_WRITE
public static final int ALLOW_BLEND_COLOR_READ
public static final int ALLOW_BLEND_COLOR_WRITE
public static final int ALLOW_TRANSFORM_READ
public static final int ALLOW_TRANSFORM_WRITE
These flags, when enabled using the setCapability method, allow an application to invoke methods that respectively read and write its individual component field information.

Constructors
public TextureAttributes()
Constructs a TextureAttributes object with default parameters:
 
Parameter Default Value
textureMode REPLACE
blendColor black (0,0,0,0)
transform null
perspCorrectionMode NICEST
public TextureAttributes(int textureMode, Transform3D transform, 
       Color4f textureBlendColor, int perspCorrectionMode)
These constructors create a new TextureAttributes object with the specified parameters.

Methods
public final void setTextureMode(int textureMode)
public final int getTextureMode()
These methods set and retrieve the texture mode parameter for this Texture-Attributes component object. The texture mode is one of the following:
public final void setTextureBlendColor(Color4f textureBlendColor)
public final void setTextureBlendColor(float r, float g, float  b, 
       float  a)
public final void getTextureBlendColor(Color4f textureBlendColor)
These methods set and retrieve the texture blend color for this TextureAttributes component object. The texture blend color is used when the texture mode parameter is BLEND.
public final void setTextureTransform(Transform3D transform)
public final void getTextureTransform(Transform3D transform)
These methods set and retrieve the texture transform object used to transform texture coordinates. A copy of the specified Transform3D object is stored in this TextureAttributes object.
public final void setPerspectiveCorrectionMode(int mode)
public final int getPerspectiveCorrectionMode()
These methods set and retrieve the perspective correction mode to be used for color and texture coordinate interpolation. The perspective correction mode is one of the following:
public NodeComponent cloneNodeComponent()
public void duplicateNodeComponent(NodeComponent originalNode)
The first method creates a new TextureAttributes object; this method is called from a leaf node's duplicateNode method. The second method copies the information found in originalNode to the current node; this method is called as part of the cloneTree operation.

7.1.8 TransparencyAttributes Object

The TransparencyAttributes object defines all attributes affecting the transparency of the object.

Constants
public static final int ALLOW_MODE_READ
public static final int ALLOW_MODE_WRITE
public static final int ALLOW_VALUE_READ
public static final int ALLOW_VALUE_WRITE
These flags, when enabled using the setCapability method, allow an application to invoke methods that respectively read and write its individual component field information.

Constructors
public TransparencyAttributes()
Constructs a new TransparencyAttributes object with default values:
 
Parameter Default Value
transparencyMode NONE
transparencyValue 0.0
public TransparencyAttributes(int tMode, float tVal)
Constructs a new TransparencyAttributes object with specified values.

Methods
public final void setTransparencyMode(int transparencyMode)
public final int getTransparencyMode()
These methods set and retrieve the transparency mode for this Appearance component object. The transparency mode is one of the following:
public final void setTransparency(float transparency)
public final float getTransparency()
These methods set and retrieve this Appearance object's transparency value. The transparency value is in the range [0.0, 1.0], with 0.0 being fully opaque and 1.0 being fully transparent.
public NodeComponent cloneNodeComponent()
public void duplicateNodeComponent(NodeComponent originalNode)
The first method creates a new TransparencyAttributes object; this method is called from a leaf node's duplicateNode method. The second method copies the information found in originalNode to the current node; this method is called as part of the cloneTree operation.

7.1.9 Material Object

The Material object is a component object of an Appearance object that defines the material properties used when lighting is enabled. If the Material object in an Appearance object is null, lighting is disabled for all nodes that use that Appearance object.

Constants
The Material object defines two flags.
public static final int ALLOW_COMPONENT_READ
public static final int ALLOW_COMPONENT_WRITE
These flags, when enabled using the setCapability method, allow an application to invoke methods that respectively read and write its individual component field information.

Constructors
The Material object has the following constructors.
public Material()
Constructs and initializes a Material object using default values for all attributes. The default values are as follows:

Parameter Default Value
lightingEnable true
ambientColor (0.2, 0.2, 0.2)
emissiveColor (0.0, 0.0, 0.0)
diffuseColor (1.0, 1.0, 1.0)
specularColor (1.0, 1.0, 1.0)
shininess 64

public Material(Color3f ambientColor, Color3f emissiveColor, 
       Color3f diffuseColor, Color3f specularColor, 
       float  shininess)
Constructs and initializes a new Material object using the specified parameters. The ambient color, emissive color, diffuse color, specular color, and shininess parameters are specified.

Methods
The Material object has the following methods.
public final void setAmbientColor(Color3f color)
public final void setAmbientColor(float r, float g, float b)
public final void getAmbientColor(Color3f color)
This parameter specifies this material's ambient color, that is, how much ambient light is reflected by the material's surface.
public final void setEmissiveColor(Color3f color)
public final void setEmissiveColor(float r, float g, float b)
public final void getEmissiveColor(Color3f color)
This parameter specifies the color of light, if any, that the material emits. This color is added to the color produced by applying the lighting equation.
public final void setDiffuseColor(Color3f color)
public final void setDiffuseColor(float r, float g, float b)
public final void setDiffuseColor(float r, float g, float b, 
       float  a)
public final void getDiffuseColor(Color3f color)
This parameter specifies the color of the material when illuminated by a light source. In addition to the diffuse color (red, green, and blue), the alpha value is used to specify transparency such that transparency = (1 - alpha).
public final void setSpecularColor(Color3f color)
public final void setSpecularColor(float r, float g, float b)
public final void getSpecularColor(Color3f color)
This parameter specifies the specular highlight color of the material.
public final void setShininess(float shininess)
public final float getShininess()
This parameter specifies a material specular scattering exponent, or shininess. It takes a floating-point number in the range [1.0, 128.0], with 1.0 being not shiny and 128.0 being very shiny.
public final void setLightingEnable(boolean state)
public final boolean getLightingEnable()
These methods set and retrieve the current state of the lighting enable flag (true or false) for this Appearance component object.
public NodeComponent cloneNodeComponent()
public void duplicateNodeComponent(NodeComponent originalNode)
The first method creates a new Material object; this method is called from a leaf node's duplicateNode method. The second method copies the information found in originalNode to the current node; this method is called as part of the cloneTree operation.
public String toString()
This method returns a string representation of this Material's values. If the scene graph is live, only those values with their capability bit set will be displayed.

7.1.10 Texture Object

The Texture object is a component object of an Appearance object that defines the texture properties used when texture mapping is enabled. If the Texture object in an Appearance object is null, then texture mapping is disabled for all nodes that use that Appearance object. The Texture object is an abstract class. As such, all texture objects must be created as either a Texture2D object or a Texture3D object.

Constants
The Texture object defines the following flags:
public static final int ALLOW_ENABLE_READ
public static final int ALLOW_ENABLE_WRITE
public static final int ALLOW_BOUNDARY_MODE_READ
public static final int ALLOW_FILTER_READ
public static final int ALLOW_IMAGE_READ
public static final int ALLOW_MIPMAP_MODE_READ
public static final int ALLOW_BOUNDARY_COLOR_READ
These flags, when enabled using the setCapability method, allow an application to invoke methods that read, and in some cases write, its individual component field information.

Constructors
The Texture object has the following constructor.
public Texture()
This constructor is not very useful as the default width and height are 0. The other default values are as follows:
 
Parameter Default Value
enableFlag true
mipmapMode BASE_LEVEL
format RGB
boundaryModeS WRAP
boundaryModeT WRAP
minificationFilter BASE_LEVEL_POINT
magnificationFilter BASE_LEVEL_POINT
boundaryColor black (0,0,0,0)
textureImage null
public Texture(int mipmapMode, int format, int width, int  height)
Constructs an empty Texture object with specified mipmapMode format, width, and height. Image at level 0 must be set by the application using the setImage method. The mipmapMode can be one of the following: The format is the data of textures saved in this object. The format can be one of the following:
Methods
The Texture object has the following methods.
public final void setBoundaryModeS(int boundaryModeS)
public final int getBoundaryModeS()
public final void setBoundaryModeT(int boundaryModeT)
public final int getBoundaryModeT()
These parameters specify the boundary mode for the S and T coordinates in this Texture object. The boundary mode is as follows:
public final void setMinFilter(int minFilter)
public final int getMinFilter()
This parameter specifies the minification filter function. This function is used when the pixel being rendered maps to an area greater than one texel. The minification filter is one of the following:
public final void setMagFilter(int magFilter)
public final int getMagFilter()
This parameter specifies the magnification filter function. This function is used when the pixel being rendered maps to an area less than or equal to one texel. The value is one of the following:
public final void setImage(int level, ImageComponent image)
public final ImageComponent getImage(int level)
These methods set and retrieve a specified mipmap level. Level 0 is the base level.
public final void setBoundaryColor(Color4f boundaryColor)
public final void setBoundaryColor(float r, float g, float b, 
       float  a)
public final void getBoundaryColor(Color4f boundaryColor)
This parameter specifies the texture boundary color for this Texture object. The texture boundary color is used when boundaryModeS or boundaryModeT is set to CLAMP.
public final void setEnable(boolean state)
public final boolean getEnable()
These methods set and retrieve the state of texture mapping for this Texture object. A value of true means that texture mapping is enabled, false means that texture mapping is disabled.
public final void setMipMapMode(int mipmapMode)
public final int getMipMapMode()
These methods set and retrieve the mipmap mode for texture mapping for this Texture object. The mipmap mode is either BASE_LEVEL or MULTI_LEVEL_MIP_MAP.

7.1.11 Texture2D Object

The Texture2D object is a subclass of the Texture class. It extends the Texture class by adding a constructor for setting a 2D texture image.

Constructors
The Texture2D object has the following constructors.
public Texture2D()
This constructor is not very useful as the default width and height are 0.
public Texture2D(int mipmapMode, int format, int width, int  height)
Constructs and initializes a Texture2D object with the specified attributes. The mipmapMode parameter is either BASE_LEVEL or MULTI_LEVEL_MIPMAP. The format parameter is one of the following: INTENSITY, LUMINANCE, ALPHA, LUMI-NANCE_ALPHA, RGB, or RGBA.

Methods
public NodeComponent cloneNodeComponent()
public void duplicateNodeComponent(NodeComponent originalNode)
The first method creates a new Texture2D object; this method is called from a leaf node's duplicateNode method. The second method copies the information found in originalNode to the current node; this method is called as part of the cloneTree operation.

7.1.12 Texture3D Object

The Texture3D object is a subclass of the Texture class. It extends the Texture class by adding a third texture coordinate and by adding a constructor for setting a 3D texture image.

Constructors
The Texture3D object has the following constructors.
public Texture3D()
Constructs a Texture3D object with default parameters.

Parameter Default Value
depth 0
boundaryModeR WRAP

public Texture3D(int mipmapMode, int format, int width, int  height, 
       int depth)
Constructs and initializes a Texture3D object using the specified attributes. The mipmapMode parameter is either BASE_LEVEL or MULTI_LEVEL_MIPMAP. The format parameter is one of INTENSITY, LUMINANCE, ALPHA, LUMINANCE_ALPHA, RGB, or RGBA. The default value for a Texture3D object is as follows:

Parameter Default Value
boundaryModeR WRAP

Methods
The Texture3D object has the following methods.
public final void setBoundaryModeR(int boundaryModeR)
public final int getBoundaryModeR()
This parameter specifies the boundary mode for the R coordinate in this Texture object. The boundary mode is as follows:
public NodeComponent cloneNodeComponent()
public void duplicateNodeComponent(NodeComponent originalNode)
The first method creates a new Texture3D object; this method is called from a leaf node's duplicateNode method. The second method copies the information found in originalNode to the current node; this method is called as part of the cloneTree operation.

7.1.13 TexCoordGeneration Object

The TexCoordGeneration object is a component object of an Appearance object that defines the parameters used when texture coordinate generation is enabled. If the TexCoordGeneration object in an Appearance object is null, texture coordinate generation is disabled for all nodes that use that Appearance object.

Constants
The TexCoordGeneration object specifies the following variables.
public final static int ALLOW_ENABLE_READ
public final static int ALLOW_ENABLE_WRITE
public final static int ALLOW_FORMAT_READ
public final static int ALLOW_MODE_READ
public final static int ALLOW_PLANE_READ
These flags, when enabled using the setCapability method, allow an application to invoke methods that read, and in some cases write, its individual component field information.
public final static int OBJECT_LINEAR
Generates texture coordinates as a linear function in object coordinates.
public final static int EYE_LINEAR
Generates texture coordinates as a linear function in eye coordinates.
public final static int SPHERE_MAP
Generates texture coordinates using a spherical reflection mapping in eye coordinates.
public final static int TEXTURE_COORDINATE_2
Generates 2D texture coordinates (S and T).
public final static int TEXTURE_COORDINATE_3
Generates 3D texture coordinates (S, T, and R).

Constructors
The TexGen object has the following constructors.
public TexCoordGeneration()
Constructs a TexCoordGeneration object with default parameters:

Parameter Default Value
enableFlag true
textureGenerationMode OBJECT_LINEAR
format TEXTURE_COORDINATE_2
planeS (1,0,0,0)
planeT (0,1,0,0)
planeR (0,0,0,0)

public TexCoordGeneration(int genMode, int format)
public TexCoordGeneration(int genMode, int format, 
       Vector4f  planeS)
public TexCoordGeneration(int genMode, int format, 
       Vector4f  planeS, Vector4f planeT)
public TexCoordGeneration(int genMode, int format, 
       Vector4f  planeS, Vector4f planeT, Vector4f planeR)
These constructors construct a TexCoordGeneration object by initializing the specified fields. Default values are used for those state variables not specified in the constructor. The parameters are as follows:
Methods
The TexGen object has the following methods.
public final void setEnable(boolean state)
public final boolean getEnable()
This parameter enables or disables texture coordinate generation for this Appearance component object. The value is true if texture coordinate generation is enabled, false if texture coordinate generation is disabled.
public final void setFormat(int format)
public final int getFormat()
This parameter specifies the format, or dimension, of the generated texture coordinates. The format value is either TEXTURE_COORDINATE_2 or TEXTURE_COORD-INATE_3.
public final void setGenMode(int genMode)
public final int getGenMode()
This parameter specifies the texture coordinate generation mode. The value is one of OBJECT_LINEAR, EYE_LINEAR, or SPHERE_MAP.
public final void setPlaneS(Vector4f planeS)
public final void getPlaneS(Vector4f planeS)
This parameter specifies the S coordinate plane equation. This plane equation is used to generate the S coordinate in OBJECT_LINEAR and EYE_LINEAR texture generation modes.
public final void setPlaneT(Vector4f planeT)
public final void getPlaneT(Vector4f planeT)
This parameter specifies the T coordinate plane equation. This plane equation is used to generate the T coordinate in OBJECT_LINEAR and EYE_LINEAR texture generation modes.
public final void setPlaneR(Vector4f planeR)
public final void getPlaneR(Vector4f planeR)
This parameter specifies the R coordinate plane equation. This plane equation is used to generate the R coordinate in OBJECT_LINEAR and EYE_LINEAR texture generation modes.
public NodeComponent cloneNodeComponent()
public void duplicateNodeComponent(NodeComponent originalNode)
The first method creates a new TexCoordGeneration object; this method is called from a leaf node's duplicateNode method. The second method copies the information found in originalNode to the current node; this method is called as part of the cloneTree operation.

7.1.14 MediaContainer Object

The MediaContainer object defines all sound data: cached state flag and associated sound data. Currently, this references the media in the form of a URL path to the sound data. In a future release of Java 3D, the MediaContainer object will include references to Java Media Framework objects.

Constants
The MediaContainer object has the following flags.
public static final int ALLOW_CACHE_READ
public static final int ALLOW_CACHE_WRITE
public static final int ALLOW_URL_READ
public static final int ALLOW_URL_WRITE
These flags, when enabled using the setCapability method, allow an application to invoke methods that read or write its cached flag and its URL string.

Constructors
The MediaContainer object has the following constructors.
public MediaContainer()
Constructs and initializes a new MediaContainer object using the following default values.

Parameter Default Value
cacheData true
URL null

public MediaContainer(String path)
public MediaContainer(URL url)
Constructs and initializes a new MediaContainer object using the specified path and forcing the cache data flag to true.

Methods
The Sound object has the following methods.
public final void setCacheEnable(boolean flag)
public final boolean getCacheEnable()
This parameter specifies whether this component contains a noncached reference to the sound data or explicit cached sound data.
public final void setURL(String path)
public final void setURL(URL url)
public final String getURL()
This parameter specifies the string path (URL) of the sound data associated with this component.

7.1.15 AuralAttributes Object

The AuralAttributes object is a component object of a Soundscape node that defines environmental audio parameters that affect sound rendering. These attributes include gain scale factor, atmospheric rolloff, and parameters controlling reverberation, distance frequency filtering, and velocity-activated Doppler effect.

7.1.15.1 Attribute Gain Rolloff

The rolloff scale factor is used to model atmospheric changes from the normal speed of sound. The base value, 0.344 meters per millisecond used to approximate the speed of sound through air at room temperature, is multiplied by this scale factor whenever the speed of sound is applied during spatialization calculations. Valid values are  0.0. Values > 1.0 increase the speed of sound, while values < 1.0 decrease its speed. A value of zero makes the sound silent (but the sound continues to play).

7.1.15.2 Reverberation

Within Java 3D's simple model for auralization, there are three components to sound reverberation for a particular listening space: None of these parameters are affected by sound position. Figure 7-2 shows the interaction of these parameters.

The reflection coefficient for reverberation is a single scale factor used to approximate the overall reflective or absorptive characteristics of the surfaces in a reverberation region in which the listener is located. This scale factor is applied to the sound's amplitude regardless of the sound's position. A value of 1.0 represents complete (unattenuated) sound reflection, while a value of 0.0 represents full absorption (reverberation is disabled).

The reverberation delay time is set either explicitly (in milliseconds), or implicitly by supplying an additional bounds volume (so the delay time can be calculated). The bounds of the reverberation space do not have to be the same as the application region of the Soundscape node using this object.

The reverberation order defines the number of reverberation (feedback) loop iterations to be executed while a sound is played. As long as the reflection coefficient is small enough, the reverberated sound decreases (as it would naturally) each successive iteration. A value of 0 disables reverberation, a value of 1 creates a single echo (given that the reverb delay is long enough), and a value of -1 signifies that reverberation is to loop until it reaches an amplitude of effective zero (>60 dB or 1/1000 of sound amplitude). All other positive values are used as the number of loop iterations.

7.1.15.3 Doppler Effect

Doppler effect can be used to create a greater sense of movement of sound sources and can help unambiguate front-to-back localization errors. The frequency of sound waves emanating from the source are raised or lowered based on the speed of the source in relation to the listener, and several AuralAttributes parameters.

The frequency scale factor can be used to increase or reduce the change of frequency associated with the normal Doppler calculation, or to shift the pitch of the sound directly if Doppler-effect is disabled. Values must be > 0.0 for sounds to be heard. If the value is 0.0, sounds affected by this AuralAttributes object are paused.

To simulate Doppler effect, the relative velocity (change in distance in the local coordinate system between the sound source and the listener over time, in meters per second) is calculated. This calculated velocity is multiplied by the given velocity scale factor. Values must be  0.0. If the scale factor value is 0.0, Doppler effect is not calculated or applied to the sound.

Constants
The AuralAttributes object has the following flags.
public static final int ALLOW_ATTRIBUTE_GAIN_READ
public static final int ALLOW_ATTRIBUTE_GAIN_WRITE
public static final int ALLOW_ROLLOFF_READ
public static final int ALLOW_ROLLOFF_WRITE
public static final int ALLOW_REFLECTION_COEFFICIENT_READ
public static final int ALLOW_REFLECTION_COEFFICIENT_WRITE
public static final int ALLOW_REVERB_DELAY_READ
public static final int ALLOW_REVERB_DELAY_WRITE
public static final int ALLOW_REVERB_ORDER_READ
public static final int ALLOW_REVERB_ORDER_WRITE
public static final int ALLOW_DISTANCE_FILTER_READ
public static final int ALLOW_DISTANCE_FILTER_WRITE
public static final int ALLOW_FREQUENCY_SCALE_FACTOR_READ
public static final int ALLOW_FREQUENCY_SCALE_FACTOR_WRITE
public static final int ALLOW_VELOCITY_SCALE_FACTOR_READ
public static final int ALLOW_VELOCITY_SCALE_FACTOR_WRITE
These flags, when enabled using the setCapability method, allow an application to invoke methods that read or write the associated parameters.

The following AuralAttributes flags are deprecated:

public static final int ALLOW_DOPPLER_SCALE_FACTOR_READ
Use ALLOW_FREQUENCY_SCALE_FACTOR_READ instead.
public static final int ALLOW_DOPPLER_SCALE_FACTOR_WRITE
Use ALLOW_FREQUENCY_SCALE_FACTOR_WRITE instead.
public static final int ALLOW_DOPPLER_VELOCITY_READ
Use ALLOW_VELOCITY_SCALE_FACTOR_READ instead.
public static final int ALLOW_DOPPLER_VELOCITY_WRITE
Use ALLOW_VELOCITY_SCALE_FACTOR_WRITE instead.

Constructors
The AuralAttributes object has the following constructors.
public AuralAttributes()
Constructs and initializes a new AuralAttributes object using the following default values:

Parameter Default Value
attributeGain 1.0
rolloff 1.0
reflectionCoeff 0.0
reverbDelay 0.0
reverbOrder 0
distanceFilter null (no filtering performed)
frequencyScaleFactor 1.0
velocityScaleFactor 1.0

public AuralAttributes(float gain, float rolloff, 
       float  reflectionCoefficient, float reverbDelay, 
       int  reverbOrder, Point2f distanceFilter[], 
       float  frequencyScaleFactor, float velocityScaleFactor)
public AuralAttributes(float gain, float rolloff, 
       float  reflectionCoefficient, float reverbDelay, 
       int  reverbOrder, float distance[], float frequencyCutoff, 
       float frequencyScaleFactor, float velocityScaleFactor)
Construct and initialize a new AuralAttributes object using the specified parameters.

Methods
The AuralAttributes object has the following methods.
public final void setAttributeGain(float gain)
public final float getAttributeGain()
This parameter specifies an amplitude scale factor applied to the sound. Valid values are  0.0.
public final void setRolloff(float rolloff)
public final float getRolloff()
The rolloff scale factor is used to model atmospheric changes from the normal speed of sound. The base value of 0.344 meters per millisecond is used to approximate the speed factor whenever the speed of sound is applied during spatialization calculations. Valid values are  0.0. Values > 1.0 increase the speed of sound; a value of 0.0 makes the sound silent (but the sound continues to play).
public final void setReflectionCoefficient(float coefficient)
public final float getReflectionCoefficient()
This parameter specifies an average amplitude scale factor for all sound waves (independent of their frequencies) as they reflect off all surfaces within the activation region in which the listener is located. There is currently no method to assign different reflective audio properties to individual surfaces. The range of values is 0.0 to 1.0. A value of 0.0 represents a fully absorptive surface (no sound waves reflect off), while a value of 1.0 represents a fully reflective surface (amplitudes of sound waves reflecting off surfaces are not decreased).
public final void setReverbDelay(float reverbDelay)
public final void setReverbDelay(Bounds reverbVolume)
public final float getReverbDelay()
This parameter specifies the delay time between each order of reflection while reverberation is being rendered. In the first form of setReverbDelay, an explicit delay time is given in milliseconds. In the second form, a reverberation bounds volume is specified, and then the delay time is calculated, becoming the new reverb time delay. A value of 0.0 for delay time disables reverberation.
public final void setReverbOrder(int reverbOrder)
public final int getReverbOrder()
This parameter specifies the maximum number of times reflections will be added to the reverberation being calculated. When the amplitude of the n-th reflection reaches effective zero, no further reverberations need be added to the sound image. A value of 0 disables reverberation. A value of -1 specifies that the reverberation calculations will loop indefinitely, until the n-th reflection term reaches effective zero.
public final void setDistanceFilter(Point2f attenuation[])
public final void setDistanceFilter(float distance[], 
       float  frequencyCutoff[])
public final int getDistanceFilterLength()
public final void getDistanceFilter(Point2f attenuation[])
public final void getDistanceFilter(float distance[], 
       float  frequencyCutoff[])
This parameter specifies a (distance, filter) attenuation pairs array. If this is not set, no distance filtering is performed (equivalent to using a distance filter of Sound.NO_FILTER for all distances). Currently, this filter is a low-pass cutoff frequency. This array of pairs defines a piecewise linear slope for a range of values. This attenuation array is similar to the PointSound node's distanceAttenuation pair array, except that frequency values are paired with distances in this list. Using these pairs, distance-based low-pass frequency filtering can be applied during sound rendering. Distances, specified in the local coordinate system in meters, must be > 0. Frequencies (in Hz) must be > 0.

If the distance from the listener to the sound source is less than the first distance in the array, the first filter is applied to the sound source. This creates a spherical region around the listener within which a sound is uniformly attenuated by the first filter in the array. If the distance from the listener to the sound source is greater than the last distance in the array, the last filter is applied to the sound source.

The first form of setDistanceFilter takes these pairs of values as an array of Point2f. The second form accepts two separate arrays for these values. The distance and frequencyCutoff arrays should be of the same length. If the frequencyCutoff array length is greater than the distance array length, the frequencyCutoff array elements beyond the length of the distance array are ignored. If the frequencyCutoff array is shorter than the distance array, the last frequencyCutoff array value is repeated to fill an array of length equal to the distance array.

The getDistanceFilterLength method returns the length of the distance filter arrays. Arrays passed into getDistanceFilter methods should all be at least this size.

There are two methods for getDistanceFilter, one returning an array of points, the other returning separate arrays for each attenuation component.

Distance elements in this array of pairs are a monotonically increasing set of floating-point numbers measured from the location of the sound source. Frequency cutoff elements in this list of pairs can be any positive float. While for most applications this list of values will usually be monotonically decreasing, they do not have to be.

public final void setDopplerScaleFactor(float 
       frequencyScaleFactor)
public final float getDopplerScaleFactor()
These methods are deprecated; use setFrequencyScaleFactor and getFrequencyScaleFactor instead.
public final void setFrequencyScaleFactor(float 
       frequencyScaleFactor)
public final float getFrequencyScaleFactor()
This parameter specifies a scale factor applied to the frequency of sound during rendering playback. If the Doppler effect is disabled, this scale factor can be used to increase or decrease the original pitch of the sound. During rendering, this scale factor expands or contracts the usual frequency shift applied to the sound source due to Doppler-effect calculations. Valid values are  0.0; a value of 0.0 pauses the sound.
public final void setDopplerVelocity(float velocityScaleFactor)
public final float getDopplerVelocity()
These methods are deprecated; use setVelocityScaleFactor and getVelocityScaleFactor instead.
public final void setVelocityScaleFactor(float 
       velocityScaleFactor)
public final float getVelocityScaleFactor()
This parameter specifies a scale factor applied to the relative velocity of the sound relative to the listener's position and movement in relation to the sound's position and movement over time. This scale factor is multiplied by the calculated velocity portion of the Doppler-effect equation used during sound rendering. This allows the application to exaggerate or reduce the relative velocity calculated by the standard Doppler equation. Valid values are  0.0. A value of 0.0 disables any Doppler calculation.

7.1.16 ImageComponent Object

The ImageComponent classes are used for texture and background images. The ImageComponent object is an abstract class that is used to define 2D or 3D ImageComponent classes.

Note that all color fields are treated as unsigned values, even though Java does not directly support unsigned variables. This means, for example, that an ImageComponent using a format of FORMAT_RGB5 can represent red, green, and blue values between 0 and 31, while an ImageComponent using a format of FORMAT_RGB8 can represent color values between 0 and 255. Even when byte values are used to create a BufferedImage with 8-bit color components, the resulting colors (bytes) are interpreted as if they were unsigned. Values greater than 127 can be assigned to a byte variable using a type cast. For example:

byteVariable = (byte) intValue;    // intValue can be > 127
If intValue is greater than 127, then byteVariable will be negative. The correct value will be extracted when it is used (by masking off the upper bits).

Constants
The ImageComponent object has the following flags:
public static final int ALLOW_SIZE_READ
public static final int ALLOW_FORMAT_READ
public static final int ALLOW_IMAGE_READ
These flags, when enabled using the setCapability method, allow an application to invoke methods that read the associated parameters.

The ImageComponent object specifies the following variables, used to define 2D or 3D ImageComponent classes. These variables specify the format of the pixel data.

public final static int FORMAT_RGB
Specifies that each pixel contains three eight-bit channels, one each for red, green, and blue. This is the same as FORMAT_RGB8.
public final static int FORMAT_RGBA
Specifies that each pixel contains four eight-bit channels, one each for red, green, blue, and alpha. This is the same as FORMAT_RGBA8.
public final static int FORMAT_RGB8
Specifies that each pixel contains three eight-bit channels, one each for red, green, and blue. This is the same as FORMAT_RGB.
public final static int FORMAT_RGBA8
Specifies that each pixel contains four eight-bit channels, one each for red, green, blue, and alpha. This is the same as FORMAT_RGBA.
public final static int FORMAT_RGB5
Specifies that each pixel contains three five-bit channels, one each for red, green, and blue.
public final static int FORMAT_RGB5_A1
Specifies that each pixel contains three five-bit channels, one each for red, green, and blue, and a one-bit channel for alpha.
public final static int FORMAT_RGB4
Specifies that each pixel contains three four-bit channels, one each for red, green, and blue.
public final static int FORMAT_RGBA4
Specifies that each pixel contains four four-bit channels, one each for red, green, blue, and alpha.
public final static int FORMAT_LUM4_ALPHA4
Specifies that each pixel contains two four-bit channels, one each for luminance and alpha.
public final static int FORMAT_LUM8_ALPHA8
Specifies that each pixel contains two eight-bit channels, one each for luminance and alpha.
public static final int FORMAT_R3_G3_B2
Specifies that each pixel contains two three-bit channels, one each for red and green, and a two-bit channel for blue.
public static final int FORMAT_CHANNEL8
Specifies that each pixel contains one eight-bit channel. The channel can be used for only luminance, alpha, or intensity.

Constructors
The ImageComponent object defines the following constructor.
public ImageComponent(int format, int width, int height)
This constructor constructs and initializes a new ImageComponent object.

Methods
The ImageComponent object defines the following methods.
public final int getWidth()
public final int getHeight()
public final int getFormat()
These methods retrieve the width, height, and format of this image component object.

7.1.17 ImageComponent2D Object

The ImageComponent2D class defines a 2D array of pixels, used for texture and background images.

Constructors
The ImageComponent2D object defines the following constructors.
public ImageComponent2D(int format, int width, int height)
public ImageComponent2D(int format, BufferedImage image)
The first constructor constructs and initializes a 2D image component object using the specified format, width, and height. The second constructor constructs and initializes a 2D image component object using the specified format and buffered image. A copy of the image is made.

Methods
The ImageComponent2D object defines the following methods.
public void set(BufferedImage image)
This method copies the specified buffered image to this 2D image component object.


Note: The image must be completely loaded before calling this function.
public final BufferedImage getImage()
This method retrieves a copy of the image in this ImageComponent2D object.

7.1.18 ImageComponent3D Object

The ImageComponent3D class defines a 3D array of pixels, used for texture images.

Constructors
The ImageComponent3D object defines the following constructors.
public ImageComponent3D(int format, int width, int height, 
       int  depth)
public ImageComponent3D(int format, BufferedImage image[])
The first constructor constructs and initializes a 3D image component object using the specified format, width, height, and depth. The second constructor constructs and initializes a 3D image component object using the specified format and the buffered image array.

Methods
The ImageComponent3D object defines the following methods.
public final int getDepth()
This method retrieves the depth of this 3D image component object.
public final BufferedImage[] getImage()
public final BufferedImage getImage(int index)
These methods retrieve a copy of the images in this ImageComponent3D object.
public final void set(BufferedImage images[])
public final void set(int index, BufferedImage image)
The first method copies the specified array of BufferedImage objects to this 3D image component object. The second method copies the specified BufferedImage object to this 3D image component object at the specified index.

7.1.19 DepthComponent Object

The DepthComponent object is an abstract base class that defines a 2D array of depth (Z) values.

Constants
The DepthComponent object has the following flags:
public static final int ALLOW_SIZE_READ
public static final int ALLOW_DATA_READ
These flags, when enabled using the setCapability method, allow an application to invoke methods that read the associated parameters.

Methods
public int getWidth()
public int getHeight()
These methods get the width and height of this object.

7.1.20 DepthComponentFloat Object

The DepthComponentFloat object extends the DepthComponent object and defines a 2D array of depth (Z) values in floating-point format in the range [0, 1]. A value of 0.0 indicates the closest Z value to the user, while a value of 1.0 indicates the farthest Z value.

Constructors
The DepthComponentFloat object defines the following constructors.
public DepthComponentFloat(int width, int height)
Constructs a new floating-point depth (Z-buffer) component object with the specified width and height.

Methods
public void setDepthData(float depthData[])
public void getDepthData(float depthData[])
These methods set and retrieve the specified depth data for this object.

7.1.21 DepthComponentInt Object

The DepthComponentInt object extends the DepthComponent object and defines a 2D array of depth (Z) values in integer format. Values are in the range [0, (2n) - 1], where n is the Z-buffer pixel depth.

Constructors
The DepthComponentInt object defines the following constructor.
public DepthComponentInt(int width, int height)
Constructs a new integer depth (Z-buffer) component object with the specified width and height.

Methods
public void setDepthData(int depthData[])
public void getDepthData(int depthData[])
These methods set and retrieve the specified depth data for this object.

7.1.22 DepthComponentNative Object

The DepthComponentNative object extends the DepthComponent object and defines a 2D array of depth (Z) values stored in the most efficient format for a particular device. Values are not accessible by the user and may only be used to read the Z values and subsequently write them back.

Constructors
The DepthComponentNative object defines the following constructor.
public DepthComponentNative(int width, int height)
Constructs a new native depth (Z-buffer) component object with the specified width and height.

7.1.23 Bounds Object

Bounds objects define three varieties of containing volumes. Java 3D uses these containing volumes to support various culling operations. The types of bounds include an axis-aligned-box volume, a spherical volume, and a bounding polytope.

Constructors
The Bounds object defines the following constructor.
public Bounds()
Constructs a new Bounds object.

Methods
The Bounds object defines the following methods.
public abstract Object clone()
Clone this object.
public abstract void set(Bounds boundsObject)
This method sets the value of this Bounds object to enclose the specified bounding object.
public abstract boolean intersect(Point3d origin, 
       Point3d  direction)
public abstract boolean intersect(Point3d point)
public abstract boolean intersect(Bounds boundsObject)
public abstract boolean intersect(Bounds boundsObjects[])
These methods test for the intersection of this Bounds object with a ray, a point, another Bounds object, or an array of Bounds objects, respectively.
public abstract Bounds closestIntersection(Bounds boundsObjects[])
This method finds the closest bounding object that intersects this bounding object.
public abstract void combine(Bounds boundsObject)
public abstract void combine(Bounds boundsObjects[])
public abstract void combine(Point3d point)
public abstract void combine(Point3d points[])
These methods combine this Bounds object with a bounding object, an array of bounding objects, a point, or an array of points, respectively.
public abstract void transform(Bounds bounds, Transform3D trans)
public abstract void transform(Transform3D trans)
The first method tranforms a Bounds object so that it bounds a volume that is the result of transforming the given bounding object by the given transform. The second method transforms the Bounds object by the given transform.
public abstract boolean isEmpty()
This method tests whether the bounds is empty. A bounds is empty if it is null (either by construction or as the result of a null intersection) or if its volume is negative. A bounds with a volume of zero is not empty.

7.1.24 BoundingBox Object

BoundingBox objects are axis-aligned bounding box volumes.

Constructors
The BoundingBox object defines the following constructors.
public BoundingBox()
public BoundingBox(Point3d lower, Point3d upper)
public BoundingBox(Bounds boundsObject)
public BoundingBox(Bounds bounds[])
The first constructor constructs and initializes a 2X unity BoundingBox about the origin. The second constructor constructs and initializes a BoundingBox from the given minimum and maximum in x, y, and z. The third constructor constructs and initializes a BoundingBox from a bounding object. The fourth constructor constructs and initializes a BoundingBox from an array of bounding objects.

Methods
The BoundingBox object defines the following methods.
public void getLower(Point3d p1)
public void setLower(Point3d p1)
public void setLower(double xmin, double ymin, double zmin)
This parameter specifies the lower corner of this bounding box.
public void getUpper(Point3d p1)
public void setUpper(Point3d p1)
public void setUpper(double xmax, double ymax, double zmax)
This parameter specifies the upper corner of this bounding box.
public void set(Bounds boundsObject)
Sets the value of this bounding region to enclose the specified bounding object.
public Object clone()
Creates a copy of this bounding box.
public void combine(Bounds boundsObject)
public void combine(Bounds boundsObjects[])
public void combine(Point3d point)
public void combine(Point3d points[])
These methods combine this bounding box with a bounding object, an array of bounding objects, a point, or an array of points, respectively.
public void transform(Bounds boundsObject, Transform3D matrix)
public void transform(Transform3D matrix)
The first method transforms a bounding box so that it bounds a volume that is the result of transforming the given bounding object by the given transform. The second method transforms the bounding box by the given transform.
public boolean intersect(Point3d origin, Vector3d direction)
public boolean intersect(Point3d point)
public boolean intersect(Bounds boundsObject)
public boolean intersect(Bounds boundsObjects[])
These methods test for the intersection of this bounding box with a ray, a point, another Bounds object, and an array of Bounds objects, respectively.
public boolean intersect(Bounds boundsObject, 
       BoundingBox  newBoundBox)
public boolean intersect(Bounds boundsObjects[], 
       BoundingBox  newBoundBox)
These methods compute a new BoundingBox that bounds the volume created by the intersection of this BoundingBox with another Bounds object or array of Bounds objects.
public Bounds closestIntersection(Bounds boundsObjects[])
This method finds the closest bounding object that intersects this bounding box.
public boolean isEmpty()
This method tests whether the bounding box is empty. A bounding box is empty if it is null (either by construction or as the result of a null intersection) or if its volume is negative. A bounding box with a volume of zero is not empty.

7.1.25 BoundingSphere Object

The BoundingSphere object defines a spherical bounding volume. It has two associated values: the center point and the radius of the sphere.

Constructors
The BoundingSphere object defines the following constructors.
public BoundingSphere()
public BoundingSphere(Point3D center, double radius)
public BoundingSphere(Bounds boundsObject)
public BoundingSphere(Bounds boundsObjects[])
The first constructor constructs and initializes a BoundingSphere to unity (radius = 1.0 and center at 0.0, 0.0, 0.0). The second constructor constructs and initializes a BoundingSphere from a center and radius. The third constructor constructs and initializes a BoundingSphere from a bounding object. The fourth constructor constructs and initializes a BoundingSphere from an array of bounding objects.

Methods
The BoundingSphere object defines the following methods.
public double getRadius()
public void setRadius(double r)
This parameter specifies the bounding sphere radius.
public void getCenter(Point3d center)
public void setCenter(Point3d center)
This parameter defines the position of the bounding sphere.
public void set(Bounds boundsObject)
Sets the value of this bounding sphere to enclose the volume specified by the Bounds object.
public Object clone()
Creates a copy of the bounding sphere.
public void combine(Bounds boundsObject)
public void combine(Bounds boundsObjects[])
public void combine(Point3d point)
public void combine(Point3d points[])
These methods combine this bounding sphere with a bounding object, an array of bounding objects, a point, or an array of points, respectively.
public boolean intersect(Point3d origin, Point3d direction)
public boolean intersect(Point3d point)
public boolean intersect(Bounds boundsObject)
public boolean intersect(Bounds boundsObjects[])
These methods test for the intersection of this bounding sphere with the given ray, point, another Bounds object, or an array of Bounds objects.
public boolean intersect(Bounds boundsObject, 
       BoundingSphere  newBoundSphere)
public boolean intersect(Bounds boundsObjects[], 
       BoundingSphere  newBoundSphere)
These methods compute a new BoundingSphere that bounds the volume created by the intersection of this BoundingSphere with another Bounds object or array of Bounds objects.
public Bounds closestIntersection(Bounds boundsObjects[])
This method finds the closest bounding object that intersects this bounding sphere.
public void transform(Bounds boundsObject, Transform3D matrix)
public void transform(Transform3D matrix)
The first method transforms a bounding sphere so that it bounds a volume that is the result of transforming the given bounding object by the given transform. The second method transforms the bounding sphere by the given transform. Note that when transforming a bounding sphere by a transformation matrix containing a nonuniform scale or a shear, the result is a bounding sphere with a radius equal to the maximal scale in any direction-the bounding sphere does not transform into an ellipsoid.
public String toString()
This method returns a string representation of this class.
public boolean isEmpty()
This method tests whether the bounding sphere is empty. A bounding sphere is empty if it is null (either by construction or as the result of a null intersection) or if its volume is negative. A bounding sphere with a volume of zero is not empty.

7.1.26 BoundingPolytope Object

A BoundingPolytope object defines a set of planes that prescribe a convex, closed polygonal bounding region.

Constructors
The BoundingPolytope object defines the following constructors.
public BoundingPolytope()
public BoundingPolytope(Vector4d planes[])
public BoundingPolytope(Bounds boundsObject)
public BoundingPolytope(Bounds boundsObjects[])
The first constructor constructs a new BoundingPolytope object and initializes it to a cube where -1 = x,y,z 1. The second constructor constructs and initializes a BoundingPolytope from an array of bounding planes. The third constructor constructs and initializes a BoundingPolytope from a Bounds object. The final constructor constructs and initializes a BoundingPolytope from an array of Bounds objects.

Methods
The BoundingPolytope object defines the following methods.
public void setPlanes(Vector4d planes[])
public void getPlanes(Vector4d planes[])
These methods set and retrieve the bounding planes for this BoundingPolytope object.
public int getNumPlanes()
This method returns the number of bounding planes for this bounding polytope.
public void set(Bounds boundsObject)
This method sets the planes for this BoundingPolytope by keeping its current number and direction of the planes and computing new plane positions to enclose the given Bounds object.
public Object clone()
This method creates a copy of the BoundingPolytope object.
public void combine(Bounds boundsObject)
public void combine(Bounds boundsObjects[])
public void combine(Point3d point)
public void combine(Point3d points[])
These methods combine this BoundingPolytope with a bounding object, an array of bounding objects, a point, or an array of points, respectively.
public void transform(Bounds bounds, Transform3D matrix)
public void transform(Transform3D matrix)
The first method tranforms a bounding polytope so that it bounds a volume that is the result of transforming the given bounding object by the given transform. The second method transforms the bounding polytope by the given transform.
public boolean intersect(Point3d origin, Vector3d direction)
public boolean intersect(Point3d point)
public boolean intersect(Bounds boundsObject)
public boolean intersect(Bounds boundsObjects[])
These methods test for the intersection of this BoundingPolytope with the given ray, point, another Bounds object, or array of Bounds objects, respectively.
public boolean intersect(Bounds boundsObject, 
       BoundingPolytope  newBoundPolytope)
public boolean intersect(Bounds boundsObjects[], 
       BoundingPolytope  newBoundPolytope)
These methods compute a new BoundingPolytope that bounds the volume created by the intersection of this BoundingPolytope with another Bounds object or array of Bounds objects.
public Bounds closestIntersection(Bounds boundsObjects[])
This method finds the closest bounding object that intersects this bounding polytope.
public boolean isEmpty()
This method tests whether the bounding polytope is empty. A bounding polytope is empty if it is null (either by construction or as the result of a null intersection) or if its volume is negative. A bounding polytope with a volume of zero is not empty.

7.1.27 Transform3D Object

Transformations are represented by matrix multiplication and include such operations as rotation, scaling, and translation. The Transform3D object is represented internally as a 4 x 4 double-precision floating point matrix. The mathematical representation is row major, as in traditional matrix mathematics.

Constants
public static final int ZERO
public static final int IDENTITY
public static final int SCALE
public static final int TRANSLATION
public static final int ORTHOGONAL
public static final int RIGID
public static final int CONGRUENT
public static final int AFFINE
public static final int NEGATIVE_DETERMINANT
A Transform3D has an associated type that is internally computed when the transform object is constructed and updated any time it is modified. A matrix will typically have multiple types. For example, the type associated with an identity matrix is the result of ORing all of the types, except for ZERO and NEGATIVE_DETERMINANT, together. There are public methods available to get the ORed type of the transformation, the sign of the determinant, and the least general matrix type. The matrix type flags are defined as follows: A matrix is also classified by the sign of its determinant: The Java 3D model for 4 x 4 transformations is


Note: When transforming a Point3f or a Point3d, the input w is set to 1. When transforming a Vector3f or Vector3d, the input w is set to 0.
Constructors
The Transform3D object defines the following constructors.
public Transform3D()
This constructs and initializes a new Transform3D object to the identity transformation.
public Transform3D(Transform3D t1)
This constructs and initializes a new Transform3D object from the specified transform.
public Transform3D(Matrix3f m1, Vector3d t1, double s)
public Transform3D(Matrix3d m1, Vector3d t1, double s)
public Transform3D(Matrix3f m1, Vector3f t1, float s)
These construct and initialize a new Transform3D object from the rotation matrix, translation, and scale values. The scale is applied only to the rotational component of the matrix (upper 3 x 3) and not to the translational components of the matrix.
public Transform3D(Matrix4f m1)
public Transform3D(Matrix4d m1)
These construct and initialize a new Transform3D object from the 4 x 4 matrix. The type of the constructed transform is classified automatically.
public Transform3D(float matrix[])
public Transform3D(double matrix[])
These construct and initialize a new Transform3D object from the array of length 16. The top row of the matrix is initialized to the first four elements of the array, and so on. The type of the constructed transform is classified automatically.
public Transform3D(Quat4d q1, Vector3d t1, double s)
public Transform3D(Quat4f q1, Vector3d t1, double s)
public Transform3D(Quat4f q1, Vector3f t1, float s)
These construct and initialize a new Transform3D object from the quaternion q1, the translation t1, and the scale s. The scale is applied only to the rotational components of the matrix (the upper 3 x 3) and not to the translational components of the matrix.
public Transform3D(GMatrix m1)
This constructs and initializes a new Transform3D object and initializes it to the upper 4 x 4 of the specified GMatrix. If the specified matrix is smaller than 4 x 4, the remaining elements in the transformation matrix are assigned to zero.

Methods
The Transform3D object defines the following methods.
public final int getType()
This method retrieves the type of this matrix. The type is an ORed bitmask of all of the type classifications to which it belongs.
public final int getBestType()
This method retrieves the least general type of this matrix. The order of generality from least to most is as follows: ZERO, IDENTITY, SCALE, TRANSLATION, ORTHOGONAL, RIGID, CONGRUENT, and AFFINE. If the matrix is ORTHOGONAL, calling the method getDeterminantSign will yield more information.
public final void setAutoNormalize(boolean autoNormalize)
public final boolean getAutoNormalize()
These methods set and retrieve the state of autonormalization. Autonormalization performs an automatic singular value decomposition (SVD) normalization of the rotational components (upper 3 x 3) of this matrix after every subsequent matrix operation on this object, unless the boolean is subsequently set to false. The default value for this parameter is false.
public final boolean getDeterminantSign()
This method returns the sign of the determinant of this matrix. A return value of true indicates a positive determinant. A return value of false indicates a negative determinant. In general, an orthogonal matrix with a positive determinant is a pure rotation matrix; an orthogonal matrix with a negative determinant is both a rotation and a reflection matrix.
public final void setIdentity()
This method sets this transform to the identity matrix.
public final void setZero()
This method sets this transform to all zeros.
public final void setEuler(Vector3d euler)
This method sets the rotational component (upper 3 x 3) of this transform to the rotation matrix converted from the Euler angles provided. The euler parameter is a Vector3d consisting of three rotation angles applied first about the X, then the Y, then the Z axis. These rotations are applied using a static frame of reference. In other words, the orientation of the Y rotation axis is not affected by the X rotation and the orientation of the Z rotation axis is not affected by the X or Y rotation.
public final void setRotation(Matrix3d m1)
public final void setRotation(Matrix3f m1)
These methods set the rotational component (upper 3 x 3) of this transform to the values in the specified matrix; the other elements of this transform are unchanged. A singular value decomposition is performed on this object's upper 3 x 3 matrix to factor out the scale, then this object's upper 3 x 3 matrix components are replaced by the input rotational components, and finally the scale is reapplied to the rotational components.
public final void setRotation(Quat4f q1)
public final void setRotation(Quat4d q1)
These methods set the rotational component (upper 3 x 3) of this transform to the appropriate values derived from the specified quaternion; the other elements of this transform are unchanged. A singular value decomposition is performed on this object's upper 3 x 3 matrix to factor out the scale, then this object's upper 3 x 3 matrix components are replaced by the matrix equivalent of the quaternion, and finally the scale is reapplied to the rotational components.
public final void setRotation(AxisAngle4d a1)
public final void setRotation(AxisAngle4f a1)
These methods set the rotational component (upper 3 x 3) of this transform to the appropriate values derived from the specified axis-angle; the other elements of this transform are unchanged. A singular value decomposition is performed on this object's upper 3 x 3 matrix to factor out the scale, then this object's upper 3 x 3 matrix components are replaced by the matrix equivalent of the axis-angle, and finally the scale is reapplied to the rotational components.
public final void setScale(double scale)
public final double getScale()
The set method sets the scale component of this transform by factoring out the current scale from the rotational component and multiplying by the new scale. The get method performs an SVD normalization of this transform to calculate and return the scale factor; this transform is not modified. If the matrix has non-uniform scale factors, the largest of the x, y, and z scale factors will be returned.
public final void setScale(Vector3d scale)
public final void getScale(Vector3d scale)
The set method sets the possibly non-uniform scale component to the current transform. Any existing scale is first factored out of the existing transform before the new scale is applied. The get method returns the possibly non-uniform scale components of the current transform and places them into the scale vector.
public final void setNonUniformScale(double xScale, double  yScale, 
       double zScale)
This is a deprecated method. Use the setScale(Vector3d) method instead.
public final void scaleAdd(double s, Transform3D t1, 
       Transform3D  t2)
public final void scaleAdd(double s, Transform3D t1)
The first method scales transform t1 by a uniform scale matrix with scale factor s, then adds transform t2 (this = S * t1 + t2). The second method scales this transform by a uniform scale matrix with scale factor s, then adds transform t1 (this = S * this + t1).
public final void setRotationScale(Matrix3f m1)
public final void setRotationScale(Matrix3d m1)
public final void getRotationScale(Matrix3f m1)
public final void getRotationScale(Matrix3d m1)
The set methods replace the upper 3 x 3 matrix values of this transform with the values in the matrix m1. The get methods retrieve the upper 3 x 3 matrix values of this transform and place them in the matrix m1.
public String toString()
This method returns the matrix elements of this transform as a string.
public final void add(Transform3D t1)
public final void add(Transform3D t1, Transform3D t2)
public final void sub(Transform3D t1)
public final void sub(Transform3D t1, Transform3D t2)
The first add method adds this transform to the transform t1 and places the result back into this. The second add method adds the transforms t1 and t2 and places the result into this. The first sub method subtracts transform t1 from this transform and places the result back into this. The second sub method subtracts transform t2 from t1 and places the result into this.
public final void add(double scalar)
public final void add(double scalar, Transform3D t1)
The first method adds a scalar to each component of this transform. The second method adds a scalar to each component of the transform t1 and places the result into this. Transform t1 is not modified.
public final void transpose()
public final void transpose(Transform3D t1)
The first method transposes this matrix in place. The second method transposes transform t1 and places the value into this transform. The transform t1 is not modified.
public void rotX(double angle)
public void rotY(double angle)
public void rotZ(double angle)
These three methods set the value of this matrix to a rotation matrix about the specified axis. The matrices rotate in a counter-clockwise (right-handed) direction. The angle to rotate is specified in radians.
public final void setTranslation(Vector3f trans)
public final void setTranslation(Vector3d trans)
This method modifies the translational components of this transform to the values of the argument. The other values of this transform are not modified.
public final void set(Quat4f q1)
public final void set(Quat4d q1)
These methods set the value of this transform to the matrix conversion of the quaternion argument.
public final void set(Quat4d q1, Vector3d t1, double s)
public final void set(Quat4f q1, Vector3d t1, double s)
public final void set(Quat4f q1, Vector3f t1, float s)
These methods set the value of this matrix from the rotation expressed by the quaternion q1, the translation t1, and the scale s.
public final void set(Vector3d trans)
public final void set(Vector3f trans)
These methods set the translational value of this matrix to the specified vector parameter values and set the other components of the matrix as if this transform were an identity matrix.
public final void set(Vector3d v1, double scale)
public final void set(Vector3f v1, float scale)
These methods set the value of this transform to a scale and translation matrix; the translation is scaled by the scale factor and all of the matrix values are modified.
public final void set(Transform3D t1)
This method sets the matrix, type, and state of this transform to the matrix, type, and state of the transform t1.
public final void set(double matrix[])
public final void set(float matrix[])
These methods set the matrix values of this transform to the specified matrix values.
public final void set(double scale)
public final void set(double scale, Vector3d v1)
public final void set(float scale, Vector3f v1)
The first method sets the value of this transform to a uniform scale; all of the matrix values are modified. The next two methods set the value of this transform to a scale and translation matrix; the scale is not applied to the translation and all of the matrix values are modified.
public final void set(Matrix4d m1)
public final void set(Matrix4f m1)
These methods set the matrix values of this transform to the matrix values in the specified matrix.
public final void set(Matrix3f m1)
public final void set(Matrix3d m1)
These methods set the rotational and scale components (upper 3 x 3) of this transform to the matrix values in the specified matrix. The remaining matrix values are set to the identity matrix. All values of the matrix are modified.
public final void set(Matrix3f m1, Vector3f t1, float s)
public final void set(Matrix3f m1, Vector3d t1, double s)
public final void set(Matrix3d m1, Vector3d t1, double s)
These methods set the value of this matrix from the rotation expressed by the rotation matrix m1, the translation t1, and the scale s. The scale is only applied to the rotational component of the matrix (upper 3 x 3) and not to the translational component of the matrix.
public final void set(GMatrix matrix)
These methods set the matrix values of this transform to the matrix values in the specified matrix. The GMatrix object must specify a 4 x 4, 3 x 4, or 3 x 3 matrix.
public final void set(AxisAngle4f a1)
public final void set(AxisAngle4d a1)
These methods set the rotational component (upper 3 x 3) of this transform to the matrix conversion of the specified axis-angle argument. The remaining matrix values are set to the identity matrix. All values of the matrix are modified.
public final void get(double matrix[])
public final void get(float matrix[])
These methods place the values of this transform into the specified matrix of length 16. The first four elements of the array will contain the top row of the transform matrix, and so on.
public final void get(Matrix4d matrix)
public final void get(Matrix4f matrix)
These methods place the values of this transform into the matrix argument.
public final void get(Matrix3d m1)
public final void get(Matrix3f m1)
These methods place the normalized rotational component of this transform into the 3 x 3 matrix argument.
public final double get(Matrix3d m1, Vector3d t1)
public final float get(Matrix3f m1, Vector3f t1)
public final double get(Matrix3f m1, Vector3d t1)
These methods place the normalized rotational component of this transform into the m1 parameter and the translational component into the t1 parameter.
public final void get(Quat4d q1)
public final void get(Quat4f q1)
These methods perform an SVD normalization of this matrix to acquire the normalized rotational component. The values are placed into the quaternion q1 parameter.
public final double get(Quat4d q1, Vector3d t1)
public final float get(Quat4f q1, Vector3f t1)
public final double get(Quat4f q1, Vector3d t1)
These methods perform an SVD normalization of this transform to calculate the rotation as a quaternion, the translation, and the scale. None of the matrix values are modified.
public final void get(Vector3d trans)
public final void get(Vector3f trans)
These methods retrieve the translational components of this transform.
public final void invert()
public final void invert(Transform3D t1)
The first method inverts this transform in place. The second method sets the value of this transform to the inverse of the transform t1. Both of these methods use the transform type to determine the optimal algorithm for inverting the transform.
public final double determinant()
This method calculates and returns the determinant of this transform.
public final void mul(Transform3D t1)
public final void mul(Transform3D t1, Transform3D t2)
The first method sets the value of this transform to the result of multiplying itself with transform t1 (this = this * t1). The second method sets the value of this transform to the result of multiplying transform t1 by transform t2 (this = t1 * t2).
public final void mul(double scalar)
public final void mul(double scalar, Transform3D t1)
The first method multiplies this transform by the scalar constant. The second method multiplies transform t1 by the scalar constant and places the value into this transform.
public final void mulInverse(Transform3D t1)
public final void mulInverse(Transform3D t1, Transform3D t2)
The first method multiplies this transform by the inverse of transform t1 and places the result into this transform (this = this * t1-1). The second method multiplies transform t1 by the inverse of transform t2 and places the result into this transform (this = t1 * t2-1).
public final void mulTransposeRight(Transform3D t1,Transform3D  t2)
public final void mulTransposeLeft(Transform3D t1, Transform3D  t2)
public final void mulTransposeBoth(Transform3D t1, Transform3D  t2)
The first method multiplies the transform t1 by the transpose of transform t2 and places the result into this transform (this = t1 * transpose(t2)). The second method multiplies the transpose of transform t1 by transform t2 and places the result into this transform (this = transpose(t1) * t2). The third method multiplies the transpose of transform t1 by the transpose of t2 and places the result into this transform (this = transpose(t1) * transpose(t2)).
public final void normalize()
public final void normalize(Transform3D t1)
Both of these methods use an SVD normalization. The first normalize method normalizes the rotational components (upper 3 x 3) of matrix this and places the results back into this. The second normalize method normalizes the rotational components (upper 3 x 3) of transformt1 and places the result in this.
public final void normalizeCP()
public final void normalizeCP(Transform3D t1)
Both of these methods use a cross-product (CP) normalization. The first normalizeCP method normalizes the rotational components (upper 3 x 3) of this transform and places the result into this transform. The second normalizeCP method normalizes the rotational components (upper 3 x 3 of transform t1 and places the result into this transform.
public boolean equals(Transform3D t1)
public boolean equals(Object o1)
The first method returns true if all of the data members of transform t1 are equal to the corresponding data members in this transform. The second method returns true if the Object o1 is of type Transform3D and all of the data members of o1 are equal to the corresponding data members in this Transform3D.
public boolean epsilonEquals(Transform3D t1, double epsilon)
This method returns true if the L distance between this transform and transform m1 is less than or equal to the epsilon parameter; otherwise, it returns false. The L distance is equal to:
MAX[i=0,1,2,3 ; j=0,1,2,3 ; abs[(this.m(i,j) - m1.m(i,j)]

 
public int hashCode()
This method returns a hash number based on the data values in this object. Two different Transform3D objects with identical data values (that is, true is returned for trans.equals(Transform3D)) will return the same hash number. Two Transform3D objects with different data members may return the same hash value, although this is not likely.
public final void transform(Vector4d vec, vector4d vecOut)
public final void transform(Vector4f vec, Vector4f vecOut)
public final void transform(Vector4d vec)
public final void transform(Vector4f vec)
The first two methods transform the vector vec by this transform and place the result into vecOut. The last two methods transform the vector vec by this transform and place the result back into vec.
public final void transform(Point3d point, Point3d pointOut)
public final void transform(Point3f point, point3f pointOut)
public final void transform(Point3d point)
public final void transform(Point3f point)
The first two methods transform the point parameter by this transform and place the result into pointOut. The last two methods transform the point parameter by this transform and place the result back into point. In both cases, the fourth element of the point input parameter is assumed to be 1.
public final void transform(Vector3d normal, Vector3d normalOut)
public final void transform(Vector3f normal, Vector3f normalOut)
public final void transform(Vector3d normal)
public final void transform(Vector3f normal)
The first two methods transforms the normal parameter by this transform and place the value into normalOut. The third and fourth methods transform the normal parameter by this transform and place the value back into normal.

7.1.27.1 View Model Compatibility Mode Methods: Viewing Matrix

public void lookAt(Point3d eye, Point3d center, Vector3d up)
This is a utility method that specifies the position and orientation of a viewing transformation. It works very much like the similar function in OpenGL. The inverse of this transform can be used to control the ViewPlatform object within the scene graph. Alternatively, this transform can be passed directly to the View's VpcToEc transform via the compatibility mode viewing functions defined in Section C.11.2, "Using the Camera-based View Model."

7.1.27.2 View Model Compatibility Mode Methods: Projection Matrix

public void frustum(double left, double right, double bottom, 
       double top, double near, double far)
public void perspective(double fovx, double aspect, double zNear, 
       double zFar)
public void ortho(double left, double right, double bottom, 
       double  top, double near, double far)
These three utility methods allow an application to create a perspective or parallel (orthographic) projection matrix. These three methods work very much like the similar functions in OpenGL. The resulting Transform3D can be used to directly set the View's left and right projection transforms when in compatibility mode. See Section C.11.2, "Using the Camera-based View Model," for details. The fovx parameter specifies the field of view in the x direction in radians.

7.2 Node Component Objects: Geometry

A Geometry object is an abstract class that specifies the geometry component information required by a Shape3D node. Geometry objects describe both the geometry and topology of the Shape3D nodes that reference them. Geometry objects consist of four generic geometric types: CompressedGeometry, GeometryArray, Raster, and Text3D (see Figure 7-3). Each of these geometric types defines a visible object or set of objects. A Geometry object is used as a component object of a Shape3D leaf node.

Constants
The Geometry object defines the following constant.
public static final int ALLOW_INTERSECT
This flag specifies that this Geometry object allows the intersect operation.

Constructors
public Geometry()
Constructs a new Geometry object.

7.2.1 GeometryArray Object

A GeometryArray object is an abstract class from which several classes are derived to specify a set of geometric primitives. A GeometryArray contains separate arrays of the following vertex components: coordinates, colors, normals, and texture coordinates, and a bitmask indicating which of these components are present.

A single GeometryArray contains a predefined collection of per-vertex information; all of the vertices in a GeometryArray object have the same format and primitive type. Different GeometryArrays can contain different per-vertex information. One GeometryArray might contain only three-space coordinates; another might contain per-vertex coordinates, normals, colors, and texture coordinates; yet another might contain any subset of the previous example.

All colors used in the GeometryArray object must be in the range [0.0, 1.0]. Values outside this range will cause undefined results. All normals used in the GeometryArray object must be unit length vectors. That is their geometric length must be 1.0. Normals that are not unit length vectors will cause undefined results.

Note that the term coordinate, as used in the method names and method descriptions, actually refers to a set of x, y, and z coordinates representing the position of a single vertex. The term coordinates (plural) is used to indicate sets of x, y, and z coordinates for multiple vertices. This is somewhat at odds with the mathematical definition of a coordinate, but is used as a convenient shorthand. Similarly, the term texture coordinate is used to indicate a set of texture coordinates for a single vertex, while the term texture coordinates (plural) is used to indicate sets of texture coordinates for multiple vertices.

Constants
The GeometryArray object defines the following flags.
public static final int ALLOW_COORDINATE_READ
public static final int ALLOW_COORDINATE_WRITE
These flags specify that the GeometryArray object allows reading or writing of the array of coordinates.
public static final int ALLOW_COLOR_READ
public static final int ALLOW_COLOR_WRITE
These flags specify that the GeometryArray object allows reading or writing of the array of colors.
public static final int ALLOW_NORMAL_READ
public static final int ALLOW_NORMAL_WRITE
These flags specify that the GeometryArray object allows reading or writing of the array of normals.
public static final int ALLOW_TEXCOORD_READ
public final static int ALLOW_TEXCOORD_WRITE
These flags specify that the GeometryArray object allows reading or writing of the array of texture coordinates.
public final static int ALLOW_COUNT_READ
This flag specifies that the GeometryArray object allows reading any count data (such as the vertex count) associated with the GeometryArray.
public final static int ALLOW_FORMAT_READ
This flag specifies that the GeometryArray object allows reading the vertex format associated with the GeometryArray.

Constructors
The GeometryArray object has the following constructor.
public GeometryArray(int vertexCount, int vertexFormat)
Constructs an empty GeometryArray object with the specified vertex format and number of vertices. The vertexCount parameter specifies the number of vertex elements in this array. The vertexFormat parameter is a mask indicating which vertex components are present in each vertex. The vertex format is specified as a set of flags that are bitwise ORed together to describe the per-vertex data. The following vertex formats are supported.
Methods
GeometryArray methods provide access (get and set methods) to individual vertex component arrays in two different modes: as individual elements or as arrays of multiple elements.
public final int getVertexCount()
Retrieves the number of vertices in the GeometryArray.
public final int getVertexFormat()
Retrieves the vertex format of the GeometryArray.
public final void setCoordinate(int index, float coordinate[])
public final void getCoordinate(int index, float coordinate[])
public final void setCoordinate(int index, double coordinate[])
public final void getCoordinate(int index, double coordinate[])
Sets or retrieves the coordinate associated with the vertex at the specified index of this object. The index parameter is the vertex index in this geometry array. The coordinate parameter is an array of three values containing the new coordinate.
public final void setCoordinate(int index, Point3f coordinate)
public final void getCoordinate(int index, Point3f coordinate)
public final void setCoordinate(int index, Point3d coordinate)
public final void getCoordinate(int index, Point3d coordinate)
Sets or retrieves the coordinate associated with the vertex at the specified index. The index parameter is the vertex index in this geometry array. The coordinate parameter is a vector containing the new coordinate.
public final void setCoordinates(int index, float coordinates[])
public final void getCoordinates(int index, float coordinates[])
public final void setCoordinates(int index, double coordinates[])
public final void getCoordinates(int index, double coordinates[])
Sets or retrieves the coordinates associated with the vertices starting at the specified index. The index parameter is the starting vertex index in this geometry array. The coordinates parameter is an array of 3n values containing n new coordinates. The length of the coordinates array determines the number of vertices copied.
public final void setCoordinates(int index, Point3f  coordinates[])
public final void getCoordinates(int index, Point3f  coordinates[])
public final void setCoordinates(int index, Point3d  coordinates[])
public final void getCoordinates(int index, Point3d  coordinates[])
Sets or retrieves the coordinates associated with the vertices starting at the specified index. The index parameter is the starting vertex index in this geometry array. The coordinates parameter is an array of points containing new coordinates. The length of the coordinates array determines the number of vertices copied.
public final void setCoordinates(int index, Point3d  coordinates[], 
       int start, int length)
public final void setCoordinates(int index, Point3f  coordinates[], 
       int start, int length)
public final void setCoordinates(int index, float coordinates[], 
       int start, int length)
public final void setCoordinates(int index, double coordinates[], 
       int start, int length)
These methods set the coordinates associated with the vertices starting at the specified index for this object, using coordinate data starting from vertex index start for length vertices. The index parameter is the starting destination vertex index in this geometry array.
public final void setColor(int index, float color[])
public final void getColor(int index, float color[])
public final void setColor(int index, byte color[])
public final void getColor(int index, byte color[])
Sets or retrieves the color associated with the vertex at the specified index. The index parameter is the vertex index in this geometry array. The color parameter is an array of three or four values containing the new color.
public final void setColor(int index, Color3f color)
public final void getColor(int index, Color3f color)
public final void setColor(int index, Color4f color)
public final void getColor(int index, Color4f color)
public final void setColor(int index, Color3b color)
public final void getColor(int index, Color3b color)
public final void setColor(int index, Color4b color)
public final void getColor(int index, Color4b color)
Sets or retrieves the color associated with the vertex at the specified index. The index parameter is the vertex index in this geometry array. The color parameter is a vector containing the new color.
public final void setColors(int index, float colors[])
public final void getColors(int index, float colors[])
public final void setColors(int index, byte colors[])
public final void getColors(int index, byte colors[])
Sets or retrieves the colors associated with the vertices starting at the specified index. The index parameter is the starting vertex index in this geometry array. The colors parameter is an array of 3n or 4n values containing n new colors. The length of the colors array determines the number of vertices copied.
public final void setColors(int index, Color3f colors[])
public final void getColors(int index, Color3f colors[])
public final void setColors(int index, Color4f colors[])
public final void getColors(int index, Color4f colors[])
public final void setColors(int index, Color3b colors[])
public final void getColors(int index, Color3b colors[])
public final void setColors(int index, Color4b colors[])
public final void getColors(int index, Color4b colors[])
Sets or retrieves the colors associated with the vertices starting at the specified index. The index parameter is the starting vertex index in this geometry array. The colors parameter is an array of vectors containing the new colors. The length of the colors array determines the number of vertices copied.
public final void setColors(int index, float colors[], int  start, 
       int length)
public final void setColors(int index, byte colors[], int start, 
       int length)
These methods set the colors associated with the vertices starting at the specified index for this object, using data in colors starting at index start for length colors. The index parameter is the starting destination vertex index in this geometry array. The colors parameter is an array of 3n or 4n values containing n new colors.
public final void setColors(int index, Color3f colors[], int  start, 
       int length)
public final void setColors(int index, Color4f colors[], int  start, 
       int length)
public final void setColors(int index, Color3b colors[], int  start, 
       int length)
public final void setColors(int index, Color4b colors[], int  start, 
       int length)
These methods set the colors associated with the vertices starting at the specified index for this object, using data in colors starting at index start for length colors. The index parameter is the starting destination vertex index in this geometry array. The colors parameter is an array of vectors containing new colors.
public final void setNormal(int index, float normal[])
public final void getNormal(int index, float normal[])
Sets or retrieves the normal associated with the vertex at the specified index. The index parameter is the vertex index in this geometry array. The normal parameter is the new normal.
public final void setNormal(int index, Vector3f normal)
public final void getNormal(int index, Vector3f normal)
Sets or retrieves the normal associated with the vertex at the specified index. The index parameter is the vertex index in this geometry array. The normal parameter is a vector containing the new normal.
public final void setNormals(int index, float normals[])
public final void getNormals(int index, float normals[])
Sets or retrieves the normals associated with the vertices starting at the specified index. The index parameter is the starting vertex index in this geometry array. The normals parameter is an array of 3n values containing n new normals. The length of the normals array determines the number of vertices copied.
public final void setNormals(int index, Vector3f normals[])
public final void getNormals(int index, Vector3f normals[])
Sets or retrieves the normals associated with the vertices starting at the specified index. The index parameter is the starting vertex index in this geometry array. The normals parameter is an array of vectors containing new normals. The length of the normals array determines the number of vertices copied.
public final void setNormals(int index, float normals[], int  start, 
       int length)
public final void setNormals(int index, Vector3f normals[], 
       int  start, int length)
These methods set the normals associated with the vertices starting at the specified index for this object, using data in normals starting at index start and ending at index start+length. The index parameter is the starting destination vertex index in this geometry array.
public final void setTextureCoordinate(int index, 
       float  texCoord[])
public final void getTextureCoordinate(int index, 
       float  texCoord[])
Sets or retrieves the texture coordinate associated with the vertex at the specified index. The index parameter is the vertex index in this geometry array. The texCoord parameter is an array of two or three values containing the new texture coordinate.
public final void setTextureCoordinate(int index, 
       Point2f  texCoord)
public final void getTextureCoordinate(int index, 
       Point2f  texCoord)
public final void setTextureCoordinate(int index, 
       Point3f  texCoord)
public final void getTextureCoordinate(int index, 
       Point3f  texCoord)
Sets or retrieves the texture coordinate associated with the vertex at the specified index for this object. The index parameter is the vertex index in this geometry array. The texCoord parameter is a point containing the new texture coordinate.
public final void setTextureCoordinates(int index, 
       float  texCoords[])
public final void getTextureCoordinates(int index, 
       float  texCoords[])
Sets or retrieves the texture coordinates associated with the vertices starting at the specified index for this object. The index parameter is the starting vertex index in this geometry array. The texCoords parameter is an array of 2n or 3n values containing n new texture coordinates. The length of the texCoords array determines the number of vertices copied.
public final void setTextureCoordinates(int index, 
       Point2f  texCoords[])
public final void getTextureCoordinates(int index, 
       Point2f  texCoords[])
public final void setTextureCoordinates(int index, 
       Point3f  texCoords[])
public final void getTextureCoordinates(int index, 
       Point3f  texCoords[])
Sets or retrieves the texture coordinates associated with the vertices starting at the specified index for this object. The texCoords parameter is an array of points containing the new texture coordinate. The length of the texCoords array determines the number of vertices copied.
public final void setTextureCoordinates(int index, 
       float  texCoords[], int start, int length)
public final void setTextureCoordinates(int index, 
       Point2f  texCoords[], int start, int length)
public final void setTextureCoordinates(int index, 
       Point3f  texCoords[], int start, int length)
These methods set the texture coordinates associated with the vertices starting at the specified index for this object, using data in texCoords starting at index start and ending at index start+length. The index parameter is the starting destination vertex index in this geometry array.

7.2.2 PointArray Object

The PointArray object extends GeometryArray and provides no additional methods. Objects of this class draw the array of vertices as individual points.

Constructors
public PointArray(int vertexCount, int vertexFormat)
Constructs an empty PointArray object with the specified vertex format and number of vertices.

7.2.3 LineArray Object

The LineArray object extends GeometryArray and provides no additional methods. Objects of this class draw the array of vertices as individual line segments. Each pair of vertices defines a line segment to be drawn.

Constructors
public LineArray(int vertexCount, int vertexFormat)
Constructs an empty LineArray object with the specified vertex format and number of vertices.

7.2.4 TriangleArray Object

The TriangleArray object extends GeometryArray and provides no additional methods. Objects of this class draw the array of vertices as individual triangles. Each group of three vertices defines a triangle to be drawn.

Constructors
public TriangleArray(int vertexCount, int vertexFormat)
Constructs an empty TriangleArray object with the specified vertex format and number of vertices.

7.2.5 QuadArray Object

The QuadArray object extends GeometryArray and provides no additional methods. Objects of this class draw the array of vertices as individual quadrilaterals. Each group of four vertices defines a quadrilateral to be drawn. A quadrilateral must be planar and convex or results are undefined. A quadrilateral may be rendered as a pair of triangles with either diagonal line arbitrarily chosen to split the quad.

Constructors
public QuadArray(int vertexCount, int vertexFormat)
Constructs an empty QuadArray object with the specified vertex format and number of vertices.

7.2.6 GeometryStripArray Object

GeometryStripArray is an abstract class from which all strip primitives (line strip, triangle strip, and triangle fan) are derived. In addition to specifying the array of vertex elements, which is inherited from GeometryArray, the GeometryStripArray class specifies an array of per-strip vertex counts that specifies where the separate strips appear in the vertex array.

Constructors
The GeometryStripArray object has the following constructor.
public GeometryStripArray(int vertexCount, int vertexFormat, 
       int  stripVertexCounts[])
Constructs an empty GeometryStripArray object with the specified number of vertices, vertex format, and an array of vertex counts per strip. The vertexCount parameter specifies the number of vertex elements in this array.

The stripVertexCounts parameter is an array that specifies the count of the number of vertices for each separate strip. The length of this array specifies the number of separate strips. The sum of the vertex counts for all strips, as specified by the stripVertexCounts array, must equal the total count of all vertices as specified by the vertexCount parameter.

Methods
The GeometryStripArray object has the following methods.
public final int getNumStrips()
This method returns the number of strips in the GeometryStripArray.
public final void getStripVertexCounts(int stripVertexCounts[])
This method gets an array containing a list of vertex counts for each strip.

7.2.7 LineStripArray Object

The LineStripArray extends GeometryStripArray and provides no additional methods. Objects of this class draw an array of vertices as a set of connected line strips. An array of per-strip vertex counts specifies where the separate strips appear in the vertex array. For every strip in the set, each vertex, beginning with the second vertex in the array, defines a line segment to be drawn from the previous vertex to the current vertex.

Constructors
public LineStripArray(int vertexCount, int vertexFormat, 
       int  stripVertexCounts[])
Constructs an empty LineStripArray object with the specified number of vertices, vertex format, and array of vertex counts per strip.

7.2.8 TriangleStripArray Object

The TriangleStripArray extends GeometryStripArray and provides no additional methods. Objects of this class draw an array of vertices as a set of connected triangle strips. An array of per-strip vertex counts specifies where the separate strips appear in the vertex array. For every strip in the set, each vertex, beginning with the third vertex in the array, defines a triangle to be drawn using the current vertex and the two previous vertices.

Constructors
public TriangleStripArray(int vertexCount, int vertexFormat, 
       int  stripVertexCounts[])
Constructs an empty TriangleStripArray object with the specified number of vertices, vertex format, and array of vertex counts per strip.

7.2.9 TriangleFanArray Object

The TriangleFanArray extends GeometryStripArray and provides no additional methods. Objects of this class draw an array of vertices as a set of connected triangle fans. An array of per-strip vertex counts specifies where the separate strips (fans) appear in the vertex array. For every strip in the set, each vertex, beginning with the third vertex in the array, defines a triangle to be drawn using the current vertex, the previous vertex, and the first vertex. This can be thought of as a collection of convex polygons.

Constructors
public TriangleFanArray(int vertexCount, int vertexFormat, 
       int  stripVertexCounts[])
Constructs an empty TriangleFanArray object with the specified number of vertices, vertex format, and array of vertex counts per strip.

7.2.10 IndexedGeometryArray Object

An IndexedGeometryArray object is an abstract class that extends GeometryArray to allow vertex data to be accessed via a level of indirection. In addition to the separate arrays of coordinates, colors, normals, and texture coordinates-inherited from GeometryArray-an IndexedGeometryArray object adds corresponding arrays of coordinate indices, color indices, normal indices, and texture coordinate indices.

Constants
The IndexedGeometryArray object defines the following flags.
public final static int ALLOW_COORDINATE_INDEX_READ
public final static int ALLOW_COORDINATE_INDEX_WRITE
These flags specify that the IndexedGeometryArray object allows reading or writing of the array of coordinate indices.
public static final int ALLOW_COLOR_INDEX_READ
public static final int ALLOW_COLOR_INDEX_WRITE
These flags specify that the IndexedGeometryArray object allows reading or writing of the array of color indices.
public static final int ALLOW_NORMAL_INDEX_READ
public static final int ALLOW_NORMAL_INDEX_WRITE
These flags specify that the IndexedGeometryArray object allows reading or writing of the array of normal indices.
public static final int ALLOW_TEXCOORD_INDEX_READ
public static final int ALLOW_TEXCOORD_INDEX_WRITE
These flags specify that the IndexedGeometryArray object allows reading or writing of the array of texture coordinate indices.

Constructors
The IndexedGeometryArray object has one constructor that accepts the same parameters as GeometryArray.
public IndexedGeometryArray(int vertexCount, int vertexFormat, 
       int  indexCount)
Constructs an empty IndexedGeometryArray object with the specified number of vertices, vertex format, and number of indices. The index values in each of the four index arrays (coordinates, colors, normals, and texture coordinates) are all initialized to 0.

Methods
IndexedGeometryArray methods provide access (get and set methods) to the individual vertex component index arrays that are used when rendering the geometry. This access is allowed in two different modes: as individual index elements or as arrays of multiple index elements.
public final void setCoordinateIndex(int index, 
       int  coordinateIndex)
public final int getCoordinateIndex(int index)
Sets or retrieves the coordinate index associated with the vertex at the specified index.
public final void setCoordinateIndices(int index, 
       int  coordinateIndices[])
public final void getCoordinateIndices(int index, 
       int  coordinateIndices[])
Sets or retrieves the coordinate indices associated with the vertices starting at the specified index.
public final void setColorIndex(int index, int colorIndex)
public final int getColorIndex(int index)
Sets or retrieves the color index associated with the vertex at the specified index.
public final void setColorIndices(int index, int colorIndices[])
public final void getColorIndices(int index, int colorIndices[])
Sets or retrieves the color indices associated with the vertices starting at the specified index.
public final void setNormalIndex(int index, int normalIndex)
public final int getNormalIndex(int index)
Sets or retrieves the normal index associated with the vertex at the specified index.
public final void setnormalIndices(int index, int  normalIndices[])
public final void getNormalIndices(int index, int  normalIndices[])
Sets or retrieves the normal indices associated with the vertices starting at the specified index.
public final void setTextureCoordinateIndex(int index, 
       int  texCoordIndex)
public final int getTextureCoordinateIndex(int index)
Sets or retrieves the texture coordinate index associated with the vertex at the specified index.
public final void setTextureCoordinateIndices(int index, 
       int  texCoordIndices[])
public final void getTextureCoordinateIndices(int index, 
       int  texCoordIndices[])
Sets or retrieves the texture coordinate indices associated with the vertices starting at the specified index.
public final int getIndexCount()
Retrieves the number of indices for this IndexedGeometryArray.

7.2.11 IndexedPointArray Object

The IndexedPointArray object extends IndexedGeometryArray and provides no additional methods. Objects of this class draw the array of vertices as individual points.

Constructors
The IndexedPointArray object has the following constructor.
public IndexedPointArray(int vertexCount, int vertexFormat, 
       int  indexCount)
Constructs an empty IndexedPointArray object with the specified number of vertices, vertex format (see Section 7.2.1, "GeometryArray Object," for a description of the supported vertex formats), and the number of indices in this array.

7.2.12 IndexedLineArray Object

The IndexedLineArray object extends IndexedGeometryArray and provides no additional methods. Objects of this class draw the array of vertices as individual line segments. Each pair of vertices defines a line segment to be drawn.

Constructors
The IndexedLineArray object has the following constructor.
public IndexedLineArray(int vertexCount, int vertexFormat, 
       int  indexCount)
Constructs an empty IndexedLineArray object with the specified number of vertices, vertex format, and the number of indices in this array. The vertexFormat is a mask indicating which components are present in each vertex (see Section 7.2.1, "GeometryArray Object," for a description of the supported vertex formats).

7.2.13 IndexedTriangleArray Object

The IndexedTriangleArray object extends IndexedGeometryArray and provides no additional methods. Objects of this class draw the array of vertices as individual triangles. Each group of three vertices defines a triangle to be drawn.

Constructors
The IndexedTriangleArray object has the following constructor.
public IndexedTriangleArray(int vertexCount, int vertexFormat, 
       int  indexCount)
Constructs an empty IndexedTriangleArray object with the specified number of vertices, vertex format, and the number of indices in this array. The vertexFormat is a mask indicating which components are present in each vertex (see Section 7.2.1, "GeometryArray Object," for a description of the supported vertex formats).

7.2.14 IndexedQuadArray Object

The IndexedQuadArray object extends IndexedGeometryArray and provides no additional methods. Objects of this class draw the array of vertices as individual quadrilaterals. Each group of four vertices defines a quadrilateral to be drawn. A quadrilateral must be planar and convex or results are undefined. A quadrilateral may be rendered as a pair of triangles with either diagonal line arbitrarily chosen to split the quad.

Constructors
The IndexedQuadArray object has the following constructor.
public IndexedQuadArray(int vertexCount, int vertexFormat, 
       int  indexCount)
Constructs an empty IndexedQuadArray object with the specified number of vertices, vertex format (see Section 7.2.1, "GeometryArray Object," for a description of the supported vertex formats), and the number of indices in this array.

7.2.15 IndexedGeometryStripArray Object

IndexedGeometryStripArray is an abstract class from which all strip primitives (line strip, triangle strip, and triangle fan) are derived. In addition to specifying the array of vertex elements, which is inherited from IndexedGeometryArray, the IndexedGeometryArrayStrip class specifies an array of per-strip index counts that specifies where the separate strips appear in the indexed vertex array.

Constructors
The IndexedGeometryStripArray object has the following constructor.
public IndexedGeometryStripArray(int vertexCount, 
       int  vertexFormat, int indexCount, int  stripIndexCounts[])
Constructs an empty IndexedGeometryStripArray object with the specified number of vertices, vertex format, number of indices in the array, and an array of index counts per strip. The vertexCount parameter specifies the number of vertex elements in this array. The vertexFormat parameter is a mask indicating which vertex components are present in each vertex. The indexCount parameter specifies the number of indices in this array. The stripIndexCounts parameter is an array that specifies the count of the number of indices for each separate strip. The length of this array specifies the number of separate strips. The sum of the index counts for all strips, as specified by the stripIndexCounts array, must equal the total count of all indices as specified by the indexCount parameter.

Methods
The IndexedGeometryArrayStrip object has the following methods.
public final int getNumStrips()
Gets the number of strips in the IndexedGeometryStripArray.
public final void getStripIndexCounts(int stripIndexCounts[])
Gets a list of the indexCounts for each strip.

7.2.16 IndexedLineStripArray Object

The IndexedLineStripArray extends IndexedGeometryStripArray and provides no additional methods. Objects of this class draw an array of vertices as a set of connected line strips. An array of per-strip index counts specifies where the separate strips appear in the indexed vertex array. For every strip in the set, each vertex, beginning with the second vertex in the array, defines a line segment to be drawn from the previous vertex to the current vertex.

Constructors
The IndexedLineStripArray object has the following constructor.
public IndexedLineStripArray(int vertexCount, int vertexFormat, 
       int indexCount, int stripIndexCounts[])
Constructs an empty IndexedLineStrip object with the specified number of vertices, vertex format, number of indices in this array, and an array that specifies number of indices for each strip. The vertexFormat parameter is a mask indicating which components are present in each vertex. This is specified as one or more individual flags that are bitwise ORed together to describe the per-vertex data (see Section 7.2.1, "GeometryArray Object," for a description of the supported vertex formats).

7.2.17 IndexedTriangleStripArray Object

The IndexedTriangleStripArray extends IndexedGeometryStripArray and provides no additional methods. Objects of this class draw an array of vertices as a set of connected triangle strips. An array of per-strip index counts specifies where the separate strips appear in the indexed vertex array. For every strip in the set, each vertex, beginning with the third vertex in the array, defines a triangle to be drawn using the current vertex and the two previous vertices.

Constructors
The IndexedTriangleStripArray object has the following constructor.
public IndexedTriangleStripArray(int vertexCount, 
       int  vertexFormat, int indexCount, int stripIndexCounts[])
Constructs an empty IndexedTriangleStripArray object with the specified number of vertices, vertex format, number of indices in this array, and an array of index counts per strip. The vertexFormat parameter is a mask indicating which components are present in each vertex. This is specified as one or more individual flags that are bitwise ORed together to describe the per-vertex data (see Section 7.2.1, "GeometryArray Object," for a description of the supported vertex formats).

7.2.18 IndexedTriangleFanArray Object

The IndexedTriangleFanArray extends IndexedGeometryStripArray and provides no additional methods. Objects of this class draw an array of vertices as a set of connected triangle fans. An array of per-strip index counts specifies where the separate strips (fans) appear in the indexed vertex array. For every strip in the set, each vertex, beginning with the third vertex in the array, defines a triangle to be drawn using the current vertex, the previous vertex, and the first vertex. This can be thought of as a collection of convex polygons.

Constructors
The IndexedTriangleFanArray object has the following constructor.
public IndexedTriangleFanArray(int vertexCount, int vertexFormat, 
       int indexCount, int stripIndexCounts[])
Constructs an empty IndexedTriangleFanArray object with the specified number of vertices, vertex format, number of indices in this array, and an array of index counts per strip. The vertexFormat parameter is a mask indicating which components are present in each vertex. This is specified as one or more individual flags that are bitwise ORed together to describe the per-vertex data (see Section 7.2.1, "GeometryArray Object," for a description of the supported vertex formats).

7.2.19 CompressedGeometry Object

The CompressedGeometry object is used to store geometry in a compressed format. CompressedGeometry objects use a special format for representing geometric information in one order of magnitude less space. The representation, though lossy, preserves significant object quality during compression. There will be parameters to allow the user to specify the degree of lossy-ness (for example, a space versus quality knob).

For more information, see Appendix B, "3D Geometry Compression."

Constants
The CompressedGeometry object specifies the following variables.
public final static int ALLOW_COUNT_READ
public final static int ALLOW_HEADER_READ
public final static int ALLOW_GEOMETRY_READ
These flags, when enabled using the setCapability method, allow an application to invoke methods that read its individual component field information.

Constructors
public CompressedGeometry(CompressedGeometryHeader hdr, 
       byte  geometry[])
Constructs a CompressedGeometry node component. The hdr field is copied into the CompressedGeometry object. The geometry parameter must conform to the compressed geometry format as described in Appendix B, "3D Geometry Compression."

Methods
public final int getByteCount()
Retrieves the size, in bytes, of the compressed geometry buffer.
public final void getCompressedGeometryHeader
       (CompressedGeometryHeader hdr)
Retrieves the header for this CompressedGeometry object. The header is copied into the CompressedGeometryHeader object provided.
public final void getCompressedGeometry(byte compGeom[])
Retrieves the compressed geometry associated with the CompressedGeometry object. Copies the compressed geometry from the CompressedGeometry object into the given array.
public final Shape3D[] decompress()
Decompresses the compressed geometry. Returns an array of Shape nodes containing the decompressed geometry objects.

7.2.20 CompressedGeometryHeader Object

The CompressedGeometryHeader object is used in conjunction with the CompressedGeometry object. The CompressedGeometryHeader object contains information specific to the compressed geometry data stored in the Com-pressed-Geometry NodeComponent object. This header is used to aid in the processing of the compressed geometry by decompression routines. All members in the CompressedGeometryHeader node are public, so no get or set routines are provided. The CompressedGeometryHeader object should be created, and all values set, by the geometry compression utility.

Constants
public static final int POINT_BUFFER
public static final int LINE_BUFFER
public static final int TRIANGLE_BUFFER
These flags indicate whether the compressed geometry is made up of individual points, line segments, or triangles.
public static final int COLOR_IN_BUFFER
public static final int ALPHA_IN_BUFFER
public static final int NORMAL_IN_BUFFER
These flags indicate whether RGB, alpha color, or normal information is initialized in the compressed geometry buffer.
public int majorVersionNumber
public int minorVersionNumber
public int minorMinorVersionNumber
These indicate the major, minor, and minor-minor version numbers for the compressed geometry format that was used to compress the geometry.
public int bufferType
This flag describes the type of data in the compressed geometry buffer. Only one type may be present in any given compressed geometry buffer.
public int bufferDataPresent
This flag indicates whether a particular data component (for example, color) is present in the compressed geometry buffer, preceding any geometric data. If a particular data type is not present then this information will be inherited from the Appearance object.
public int size
This flag indicates the size of the compressed geometry, in bytes, that needs to be applied to every point in the compressed geometry buffer to restore the geometry to its original (uncompressed) position.
public int start
This flag contains the offset in bytes of the start of the compressed geometry from the beginning of the compressed geometry buffer.
public double scale
public double xOffset
public double yOffset
public double zOffset
Deprecated flags. Compressed geometry scale, xOffset, yOffset, and zOffset should be set by a Transform.

Constructors
public CompressedGeometryHeader()
Creates a new CompressedGeometryHeader object used for the creation of a CompressedGeometry NodeComponent object. All instance data is declared public and no get or set methods are provided. All values are set to 0 by default and must be filled in by the application.

7.2.21 Raster Object

The Raster object extends Geometry to allow drawing a raster image that is attached to a 3D location in the virtual world. The Raster object contains a point that is defined in the local object coordinate system of the Shape3D node that references the Raster. The Raster object also contains a type specifier, a reference to an ImageComponent2D object or a DepthComponent object, and an integer x,y offset and a size (width, height) to allow reading or writing of a portion of the referenced image. In addition to being used as a type of geometry for drawing, a Raster object may be used to read back pixel data (color and Z-buffer) from the frame buffer in immediate mode.

The geometric extent of a Raster object is a single 3D point, specified by the raster position. This means that geometry-based picking or collision with a Raster object will only intersect the object at this single point; the 2D raster image is neither pickable nor collidable.

Constants
The Raster object defines the following flags.
public static final int ALLOW_POSITION_READ
public static final int ALLOW_POSITION_WRITE
public static final int ALLOW_OFFSET_READ
public static final int ALLOW_OFFSET_WRITE
public static final int ALLOW_IMAGE_READ
public static final int ALLOW_IMAGE_WRITE
public static final int ALLOW_DEPTH_COMPONENT_READ
public static final int ALLOW_DEPTH_COMPONENT_WRITE
public static final int ALLOW_SIZE_READ
public static final int ALLOW_SIZE_WRITE
public static final int ALLOW_TYPE_READ
These flags specify that the Raster object allows reading or writing of the position, offset, image, depth component, or size, or reading of the type.
public static final int RASTER_COLOR
Specifies a Raster object with color data. In this mode, the ImageComponent reference must point to a valid ImageComponent object.
public static final int RASTER_DEPTH
Specifies a Raster object with depth (Z-buffer) data. In this mode, the depth component reference must point to a valid DepthComponent object.
public static final int RASTER_COLOR_DEPTH
Specifies a Raster object with both color and depth (Z-buffer) data. In this mode, the image component reference must point to a valid ImageComponent object, and the depth component reference must point to a valid DepthComponent object.

Constructors
public Raster()
Constructs and initializes a new Raster object with default values:

Parameter Default Value
type RASTER_COLOR
pos (0,0,0)
offset (0,0)
size (0,0)
image null
depthComponent null

public Raster(Point3f pos, int type, int xOffset, int yOffset, 
       int  width, int height, ImageComponent2D image, 
       DepthComponent depthComponent)
public Raster(Point3f pos, int type, Point offset, Dimension  size, 
       ImageComponent2D image, DepthComponent  depthComponent)
Constructs and initializes a new Raster object with the specified values.

Methods
public void setPosition(Point3f pos)
public void getPosition(Point3f pos)
These methods set and retrieve the position, in object coordinates, of this raster. This position is transformed into device coordinates and is used as the upper-left corner of the raster.
public void setType(int type)
public int getType()
These methods set and retrieve the type of this Raster object. The type is one of the following: RASTER_COLOR, RASTER_DEPTH, or RASTER_COLOR_DEPTH.
public void setOffset(int xOffset, int yOffset)
public void setOffset(Point offset)
public void getOffset(Point offset)
These methods set and retrieve the offset within the array of pixels at which to start copying.
public void setSize(int width, int height)
public void setSize(Dimension size)
public void getSize(Dimension size)
These methods set and retrieve the number of pixels to be copied from the pixel array.
public void setImage(ImageComponent2D image)
public ImageComponent2D getImage()
These methods set and retrieve the pixel array used to copy pixels to or from a Canvas3D. This is used when the type is RASTER_COLOR or RASTER_COLOR_DEPTH.
public void setDepthComponent(DepthComponent depthComponent)
public DepthComponent getDepthComponent()
These methods set and retrieve the DepthComponent used to copy pixels to or from a Canvas3D. This is used when the type is RASTER_DEPTH or RASTER_COLOR_DEPTH.

7.2.22 Font3D Object

The Font3D object is used to contain 3D glyphs used in rendering 3D text. These 3D glyphs are constructed from a Java 2D font object and a FontExtrusion object (see Section 7.2.23, "FontExtrusion Object"). To ensure correct rendering, the 2D font object should be created with the default transform.

Constructors
public Font3D(java.awt.Font font, FontExtrusion extrudePath)
Creates a Font3D object from the specified Font object. The FontExtrusion object (see Section 7.2.23, "FontExtrusion Object") contains the extrusion path to use on the 2D font glyphs. To ensure correct rendering, the font must be created with the default AffineTransform. Passing null for the FontExtrusion parameter results in no extrusion being done.

Methods
public GeometryStripArray[] getAsTriangles(int glyphCode)
Deprecated method.
public Bounds getBounds(int glyphCode)
Deprecated method.
public final void getBoundingBox(int glyphCode, 
       BoundingBox  bounds)
This method returns the 3D bounding box of the specified glyph code.
public Font getFont()
This method returns the Java 2D font used to create this Font3D object.
public void getFontExtrusion(FontExtrusion extrudePath)
This method retrieves the FontExtrusion object used to create this Font3D object and copies it into the specified parameter. For information about the FontExtrusion object, see Section 7.2.23, "FontExtrusion Object."

7.2.23 FontExtrusion Object

The FontExtrusion object is used to describe the extrusion path for a Font3D object (see Section 7.2.22, "Font3D Object"). The extrusion path is used in conjunction with a Font2D object. The extrusion path defines the edge contour of 3D text. This contour is perpendicular to the face of the text. The contour has its origin at the edge of the glyph, with 1.0 being the height of the tallest glyph. Contour must be monotonic in x. The user is responsible for data sanity and must make sure that extrusionShape does not cause intersection of adjacent glyphs or within a single glyph, else undefined output may be generated.

Constructors
public FontExtrusion()
Creates the object with the default extrusion shape. The default extrusion shape is null, which specifies that a straight line from 0.0 to 0.2 (straight bevel) is used.
public FontExtrusion(java.awt.Shape extrusionShape)
Creates a FontExtrusion object with the specified extrusion shape. The extrusionShape parameter is used to construct the edge contour of a Font3D object. Each shape begins with an implicit point at 0.0. An IllegalArgumentException is thrown if multiple contours in extrusionShape, or contour is not monotonic, or least x-value of a contour point is not 0.0f.

Methods
public final void setExtrusionShape(java.awt.Shape extrusionShape)
public final java.awt.Shape getExtrusionShape()
These methods set and retrieve the 2D shape object associated with this FontExtrusion object. The Shape object describes the extrusion path used to create a 3D glyph from a 2D glyph. The set method sets the FontExtrusion's shape parameter. the get method gets the FontExtrusion's shape parameter.
public final void getExtrusionShape(java.awt.Shape extrusionShape)
Deprecated method.

7.2.24 Text3D Geometry Object

A Text3D object is a text string that has been converted to 3D geometry. The Font3D object (see Section 7.2.22, "Font3D Object") determines the appearance of the Text3D NodeComponent object. Each Text3D object has a text position-a point in 3D space where the text should be placed. The 3D text can be placed around this position using different alignments and paths.

Constants
The Text3D object defines the following flags.
public static final int ALLOW_FONT3D_READ
public static final int ALLOW_FONT3D_WRITE
public static final int ALLOW_STRING_READ
public static final int ALLOW_STRING_WRITE
public static final int ALLOW_POSITION_READ
public static final int ALLOW_POSITION_WRITE
public static final int ALLOW_ALIGNMENT_READ
public static final int ALLOW_ALIGNMENT_WRITE
public static final int ALLOW_PATH_READ
public static final int ALLOW_PATH_WRITE
public static final int ALLOW_CHARACTER_SPACING_READ
public static final int ALLOW_CHARACTER_SPACING_WRITE
public static final int ALLOW_BOUNDING_BOX_READ
These flags control reading and writing of the Font3D component information for Font3D, the String object, the text position value, the text alignment value, the text path value, the character spacing, and the bounding box.

Constructors
public Text3D()
Create a new Text3D object with default parameters:

Parameter Default Value
font3D null
string null
position (0,0,0)
alignment ALIGN_FIRST
path PATH_RIGHT
characterSpacing 0.0

public Text3D(Font3D font3D)
public Text3D(Font3D font3D, String string)
public Text3D(Font3D font3D, String string, Point3f position)
public Text3D(Font3D font3D, String string, Point3f position, 
       int  alignment, int path)
Create a new Text3D object with the defined parameters.

Methods
public final Font3D getFont3D()
public final void setFont3D(Font3D font3d)
These methods get and set the Font3D object associated with this Text3D object.
public final String getString()
public final void setString(String string)
These methods get and set the character string associated with this Text3D object.
public final void getPosition(Point3f position)
public final void setPosition(Point3f position)
These methods get and set the text position. The position parameter is used to determine the initial placement of the string. The text position is used in conjunction with the alignment and path to determine how the glyphs are to be placed in the scene. The default value is (0.0, 0.0, 0.0).
public final void setAlignment(int alignment)
public final int getAlignment()
These methods set and get the text alignment policy for this Text3D NodeComponent object (see Figure 7-4). The alignment parameter is used to specify how glyphs in the string are placed in relation to the position field. Valid values for the alignment field are: The default value of this field is ALIGN_FIRST.
public final void setPath(int path)
public final int getPath()
These methods set and get the node's path field. This field is used to specify how succeeding glyphs in the string are placed in relation to the previous glyph (see Figure 7-4). The path is relative to the local coordinate system of the Text3D node. The default coordinate system (see Section 3.4, "Coordinate Systems") is right-handed with +Y being up, +X horizontal to the right, and +Z directed toward the viewer. Valid values for this field are as follows: The default value of this field is PATH_RIGHT.
public final void getBoundingBox(BoundingBox bounds)
This method retrieves the 3D bounding box that encloses this Text3D object.

public final void setCharacterSpacing(float characterSpacing)
public final float getCharacterSpacing()
These methods set and get the character spacing used to construct the Text3D string. This spacing is in addition to the regular spacing between glyphs as defined in the Font object. A value of 1.0 in this space is measured as the width of the largest glyph in the 2D font. The default value is 0.0.

7.3 Math Component Objects

Java 3D defines a number of additional objects that are used in the construction and manipulation of other Java 3D objects. These objects provide low-level storage and manipulation control for users. They provide methods for representing vertex components (for example, color and position), volumes, vectors, and matrices.

The tuple and matrix math classes are not part of Java 3D per se, but they are needed by Java 3D and are defined here for convenience. Java 3D uses these classes internally and also makes them available for use by applications. These classes will be delivered in a separate javax.vecmath package. The tuple and matrix math classes are described in detail in Appendix A, "Math Objects."

7.3.1 Tuple Objects

The tuple objects, listed in Table 7-1, store tuples of length two, three, and four. Java 3D tuples are used to store various kinds of information such as colors, normals, texture coordinates, vertices, and so forth.

The tuple classes are further subdivided by storage type, such as point, vector, color, and so forth, and by class-whether the vector consists of single- or double-precision floating-point numbers or bytes. Only the floating-point tuple classes support math operations.
 
 
Table 7-1  Tuple Objects 
Class Description
Tuple2d Used to represent two-component coordinates in double-precision floating-point format. This class is further divided into the following: Point2d: Represents x,y point coordinates. Vector2d: Represents x,y vector coordinates.
Tuple2f Used to represent two-component coordinates in single-precision floating-point format. This class is further divided into the following: Point2f: Represents x,y point coordinates. TexCoord2f: Represents x,y texture coordinates. Vector2f: Represents x,y vector coordinates.
Tuple3b Used to represent three-component color information stored as three bytes. This class is further divided into the following: Color3b: Represents RGB color values.
Tuple3d Used to represent point and vector coordinates in double-precision floating-point format. This class is further divided into the following: Point3d: Represents x,y,z point coordinates. Vector3d: Represents x,y,z vector coordinates.
Tuple3f Used to represent three-component colors, point coordinates, texture coordinates, and vectors in single-precision floating-point format. This class is further divided into the following: Color3f: Represents RGB color values. Point3f: Represents x,y,z point coordinates. TexCoord3f: Represents x,y,z texture coordinates. Vector3f: Represents x,y,z vector coordinates.
Tuple4b Used to represent four-component color information stored as four bytes. This class is further divided into the following: Color4b: Represents RGB color values.
Tuple4d Used to represent four-component color information, quaternions, and vectors stored in double-precision floating-point format. This class is further divided into the following: Point4d: Represents x,y,z,w point coordinates. Quat4d: Represents x,y,z,w quaternion coordinates. Vector4d: Represents x,y,z,w vector coordinates.
Tuple4f Used to represent four-component color information, point coordinates, quaternions, and vectors in single-precision floating-point format. This class is further divided into the following: Color4f: Represents RGB color values. Point4f: Represents x,y,z,w point coordinates. Quat4f: Represents x,y,z,w quaternion coordinates. Vector4f: Represents x,y,z,w vector coordinates.
AxisAngle4d Used to represent four-component axis-angle rotations consisting of double-precision floating-point x, y, and z coordinates and a rotation angle in radians.
AxisAngle4f Used to represent four-component axis-angle rotations consisting of single-precision floating point x, y, and z coordinates and a rotation angle in radians.
GVector Used to represent a general, dynamically resizeable, one-dimensional vector class.

These are described in more detail in Appendix A, "Math Objects."

7.3.2 Matrix Objects

The matrix objects, listed in Table 7-2, define a complete 3 x 3 or 4 x 4 floating-point transformation matrix. All the vector subclasses operate using this one matrix type.
 
 
Table 7-2  Matrix Objects 
Class Description
Matrix3d Used to represent a double-precision floating-point 3 x 3 matrix.
Matrix3f Used to represent a single-precision floating-point 3 x 3 matrix.
Matrix4d Used to represent a double-precision floating-point 4 x 4 matrix.
Matrix4f Used to represent a single-precision floating-point 4 x 4 matrix.
GMatrix A double-precision, general, dynamically resizeable N x M matrix class.

These are described in more detail in Appendix A, "Math Objects."


ContentsPreviousNext

Java 3D API Specification

Copyright © 1999, Sun Microsystems, Inc. All rights reserved.