de.jreality.geometry
Class QuadMeshFactory

java.lang.Object
  extended by de.jreality.geometry.AbstractGeometryFactory
      extended by de.jreality.geometry.AbstractPointSetFactory
          extended by de.jreality.geometry.AbstractIndexedLineSetFactory
              extended by de.jreality.geometry.AbstractIndexedFaceSetFactory
                  extended by de.jreality.geometry.AbstractQuadMeshFactory
                      extended by de.jreality.geometry.QuadMeshFactory
All Implemented Interfaces:
GeometryFactory
Direct Known Subclasses:
HeightFieldFactory

public class QuadMeshFactory
extends AbstractQuadMeshFactory

This factory class supports creating and editing of quad meshes, that is, regular meshes of quadrilaterals. In contrast to the IndexedFaceSetFactory where the face indices must be explicitly set, this factory expects that the data provided to the setVertexCoordinates(DataList) method and its variants, is arranged in the special form corresponding to a quad mesh, and does not allow the face indices to be explicitly set.

Instead of providing face indices, this factory has two methods AbstractQuadMeshFactory.setULineCount(int) and AbstractQuadMeshFactory.setVLineCount(int) to describe the dimensions of the quad mesh. If you think of the data arranged in a 2D array, the rows have length u and there are v rows. To support this picture further, there is another method provided for specifying the underlying point set: setVertexCoordinates(double[][][]). In this 3D array, the left-most index counts off the rows, the middle index runs through a given row, and the right most index runs through the data for a specific vertex. There are analogous methods for setting the vertex normals, texture coordinates, colors, and relative radii.

There are also methods for specifying whether the quad mesh wraps around in the two parameter directions: AbstractQuadMeshFactory.setClosedInUDirection(boolean) and AbstractQuadMeshFactory.setClosedInVDirection(boolean). Defaults for both is false. This is used for example in the case that vertex normals are automatically generated, to identify correctly which faces are adjecent to a given vertex. Note: in case the surface is closed in one or the other direction, the factory does not remove the duplicated vertices.

There are also some other new control methods:

The underlying geometry managed by this factory is an instance of IndexedFaceSet -- there is no QuadMesh class. However, the factory provides the instance with an Attribute, GeometryUtility.QUAD_MESH_SHAPE whose value is an instance of Dimension specifying the (u,v) dimensions of the mesh -- in case a backend can optimize its handling of the geometry.

For an example, see this tutorial.

Author:
gunn
See Also:
QuadMeshFactory

Constructor Summary
QuadMeshFactory()
           
 
Method Summary
 IndexedFaceSet getQuadMesh()
           
 void setFaceAttribute(Attribute attr, DataList data)
          Superclass methods are protected so we override to make public Documentation is lacking ...
 void setFaceAttribute(Attribute attr, double[] data)
           
 void setFaceAttribute(Attribute attr, double[][] data)
           
 void setFaceAttributes(DataListSet dls)
           
 void setFaceColors(DataList data)
           
 void setFaceColors(double[] data)
           
 void setFaceColors(double[][] data)
           
 void setFaceLabels(java.lang.String[] data)
           
 void setFaceNormals(DataList data)
           
 void setFaceNormals(double[] data)
           
 void setFaceNormals(double[][] data)
           
 void setVertexAttribute(Attribute attr, DataList data)
           
 void setVertexAttribute(Attribute attr, double[] data)
           
 void setVertexAttribute(Attribute attr, double[][] data)
           
 void setVertexAttributes(DataListSet dls)
           
 void setVertexColors(java.awt.Color[] data)
           
 void setVertexColors(DataList data)
           
 void setVertexColors(double[] data)
           
 void setVertexColors(double[][] data)
           
 void setVertexColors(double[][][] cs)
           
 void setVertexCoordinates(DataList data)
           
 void setVertexCoordinates(double[] data)
           
 void setVertexCoordinates(double[][] data)
           
 void setVertexCoordinates(double[][][] points)
          A convenience method to allow users to work with a rectangular 3D array to describe a quad mesh
 void setVertexLabels(java.lang.String[] data)
           
 void setVertexNormals(DataList data)
           
 void setVertexNormals(double[] data)
           
 void setVertexNormals(double[][] data)
           
 void setVertexNormals(double[][][] data)
           
 void setVertexTextureCoordinates(DataList data)
           
 void setVertexTextureCoordinates(double[] data)
           
 void setVertexTextureCoordinates(double[][] data)
           
 void setVertexTextureCoordinates(double[][][] data)
           
 
Methods inherited from class de.jreality.geometry.AbstractQuadMeshFactory
getULineCount, getUTextureScale, getUTextureShift, getVLineCount, getVTextureScale, getVTextureShift, isClosedInUDirection, isClosedInVDirection, isEdgeFromQuadMesh, isGenerateTextureCoordinates, setClosedInUDirection, setClosedInVDirection, setEdgeFromQuadMesh, setFaceCount, setGenerateTextureCoordinates, setULineCount, setUTextureScale, setUTextureShift, setVertexCount, setVLineCount, setVTextureScale, setVTextureShift
 
Methods inherited from class de.jreality.geometry.AbstractIndexedFaceSetFactory
getIndexedFaceSet, isGenerateAABBTree, isGenerateEdgesFromFaces, isGenerateFaceLabels, isGenerateFaceNormals, isGenerateVertexNormals, setGenerateAABBTree, setGenerateEdgesFromFaces, setGenerateFaceLabels, setGenerateFaceNormals, setGenerateVertexNormals
 
Methods inherited from class de.jreality.geometry.AbstractIndexedLineSetFactory
getEdgeCount, getIndexedLineSet, getLineCount, isGenerateEdgeLabels, setGenerateEdgeLabels, setLineCount
 
Methods inherited from class de.jreality.geometry.AbstractPointSetFactory
getPointSet, getVertexCount, isGenerateVertexLabels, setGenerateVertexLabels
 
Methods inherited from class de.jreality.geometry.AbstractGeometryFactory
getGeometry, getMetric, setMetric, update
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QuadMeshFactory

public QuadMeshFactory()
Method Detail

getQuadMesh

public IndexedFaceSet getQuadMesh()

setVertexAttribute

public void setVertexAttribute(Attribute attr,
                               DataList data)

setVertexAttribute

public void setVertexAttribute(Attribute attr,
                               double[] data)

setVertexAttribute

public void setVertexAttribute(Attribute attr,
                               double[][] data)
Overrides:
setVertexAttribute in class AbstractPointSetFactory

setVertexAttributes

public void setVertexAttributes(DataListSet dls)

setVertexCoordinates

public void setVertexCoordinates(DataList data)

setVertexCoordinates

public void setVertexCoordinates(double[] data)

setVertexCoordinates

public void setVertexCoordinates(double[][] data)

setVertexCoordinates

public void setVertexCoordinates(double[][][] points)
A convenience method to allow users to work with a rectangular 3D array to describe a quad mesh

Parameters:
points - a 3-dimension, rectangular array; the first two dimensions must equal the number of v-lines (@link getVLineCount) and u-lines (@link getULineCount).

setVertexColors

public void setVertexColors(double[][][] cs)

setVertexColors

public void setVertexColors(java.awt.Color[] data)

setVertexNormals

public void setVertexNormals(DataList data)

setVertexNormals

public void setVertexNormals(double[] data)

setVertexNormals

public void setVertexNormals(double[][] data)

setVertexNormals

public void setVertexNormals(double[][][] data)

setVertexColors

public void setVertexColors(DataList data)

setVertexColors

public void setVertexColors(double[] data)

setVertexColors

public void setVertexColors(double[][] data)

setVertexTextureCoordinates

public void setVertexTextureCoordinates(DataList data)

setVertexTextureCoordinates

public void setVertexTextureCoordinates(double[] data)

setVertexTextureCoordinates

public void setVertexTextureCoordinates(double[][] data)

setVertexTextureCoordinates

public void setVertexTextureCoordinates(double[][][] data)

setVertexLabels

public void setVertexLabels(java.lang.String[] data)

setFaceAttribute

public void setFaceAttribute(Attribute attr,
                             DataList data)
Superclass methods are protected so we override to make public Documentation is lacking ...

Overrides:
setFaceAttribute in class AbstractQuadMeshFactory

setFaceAttribute

public void setFaceAttribute(Attribute attr,
                             double[] data)

setFaceAttribute

public void setFaceAttribute(Attribute attr,
                             double[][] data)

setFaceAttributes

public void setFaceAttributes(DataListSet dls)

setFaceNormals

public void setFaceNormals(DataList data)

setFaceNormals

public void setFaceNormals(double[] data)

setFaceNormals

public void setFaceNormals(double[][] data)

setFaceColors

public void setFaceColors(DataList data)

setFaceColors

public void setFaceColors(double[] data)

setFaceColors

public void setFaceColors(double[][] data)

setFaceLabels

public void setFaceLabels(java.lang.String[] data)