de.jreality.geometry
Class QuadMeshFactory

java.lang.Object
  extended by de.jreality.geometry.AbstractGeometryFactory
      extended by de.jreality.geometry.QuadMeshFactory
Direct Known Subclasses:
HeightFieldFactory

public class QuadMeshFactory
extends AbstractGeometryFactory

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 setULineCount(int) and 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: setClosedInUDirection(boolean) and 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
 int getEdgeCount()
           
 IndexedFaceSet getIndexedFaceSet()
           
 IndexedLineSet getIndexedLineSet()
           
 int getLineCount()
          Deprecated. Use setEdgeCount(int).
 PointSet getPointSet()
           
 IndexedFaceSet getQuadMesh()
           
 int getULineCount()
           
 double getUTextureScale()
           
 double getUTextureShift()
           
 int getVertexCount()
           
 int getVLineCount()
           
 double getVTextureScale()
           
 double getVTextureShift()
           
 boolean isClosedInUDirection()
           
 boolean isClosedInVDirection()
           
 boolean isEdgeFromQuadMesh()
           
 boolean isGenerateAABBTree()
           
 boolean isGenerateEdgeLabels()
           
 boolean isGenerateEdgesFromFaces()
           
 boolean isGenerateFaceLabels()
           
 boolean isGenerateFaceNormals()
           
 boolean isGenerateTextureCoordinates()
           
 boolean isGenerateVertexLabels()
           
 boolean isGenerateVertexNormals()
           
 void setClosedInUDirection(boolean close)
           
 void setClosedInVDirection(boolean close)
           
 void setEdgeFromQuadMesh(boolean b)
           
 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 setFaceCount(int count)
           
 void setFaceLabels(String[] data)
           
 void setFaceNormals(DataList data)
           
 void setFaceNormals(double[] data)
           
 void setFaceNormals(double[][] data)
           
 void setGenerateAABBTree(boolean generate)
           
 void setGenerateEdgeLabels(boolean generateEdgeLabels)
           
 void setGenerateEdgesFromFaces(boolean generateEdgesFromFaces)
           
 void setGenerateFaceLabels(boolean generateFaceLabels)
           
 void setGenerateFaceNormals(boolean generateFaceNormals)
           
 void setGenerateTextureCoordinates(boolean generateTextureCoordinates)
           
 void setGenerateVertexLabels(boolean generateVertexLabels)
           
 void setGenerateVertexNormals(boolean generateVertexNormals)
           
 void setLineCount(int count)
          Deprecated. Use setEdgeCount(int).
 void setULineCount(int newU)
           
 void setUTextureScale(double textureScale)
           
 void setUTextureShift(double textureShift)
           
 void setVertexAttribute(Attribute attr, DataList data)
           
 void setVertexAttribute(Attribute attr, double[] data)
           
 void setVertexAttribute(Attribute attr, double[][] data)
           
 void setVertexAttributes(DataListSet dls)
           
 void setVertexColors(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 setVertexCount(int count)
           
 void setVertexLabels(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)
           
 void setVLineCount(int newV)
           
 void setVTextureScale(double textureScale)
           
 void setVTextureShift(double textureShift)
           
 
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)

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 to dimension must equal the number of v-lines (@link getVLineCount) and u-lines (@link getULineCount).

setVertexColors

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

setVertexColors

public void setVertexColors(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(String[] data)

setFaceAttribute

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


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(String[] data)

setVertexCount

public void setVertexCount(int count)

setFaceCount

public void setFaceCount(int count)

getULineCount

public int getULineCount()

getVLineCount

public int getVLineCount()

setULineCount

public void setULineCount(int newU)

setVLineCount

public void setVLineCount(int newV)

isClosedInUDirection

public boolean isClosedInUDirection()

isClosedInVDirection

public boolean isClosedInVDirection()

setClosedInUDirection

public void setClosedInUDirection(boolean close)

setClosedInVDirection

public void setClosedInVDirection(boolean close)

isGenerateTextureCoordinates

public boolean isGenerateTextureCoordinates()

setGenerateTextureCoordinates

public void setGenerateTextureCoordinates(boolean generateTextureCoordinates)

getUTextureScale

public double getUTextureScale()

setUTextureScale

public void setUTextureScale(double textureScale)

getVTextureScale

public double getVTextureScale()

setVTextureScale

public void setVTextureScale(double textureScale)

getUTextureShift

public double getUTextureShift()

setUTextureShift

public void setUTextureShift(double textureShift)

getVTextureShift

public double getVTextureShift()

setVTextureShift

public void setVTextureShift(double textureShift)

isEdgeFromQuadMesh

public boolean isEdgeFromQuadMesh()

setEdgeFromQuadMesh

public void setEdgeFromQuadMesh(boolean b)

getIndexedFaceSet

public IndexedFaceSet getIndexedFaceSet()

isGenerateEdgesFromFaces

public boolean isGenerateEdgesFromFaces()

setGenerateEdgesFromFaces

public void setGenerateEdgesFromFaces(boolean generateEdgesFromFaces)

isGenerateVertexNormals

public boolean isGenerateVertexNormals()

setGenerateVertexNormals

public void setGenerateVertexNormals(boolean generateVertexNormals)

isGenerateFaceNormals

public boolean isGenerateFaceNormals()

setGenerateFaceNormals

public void setGenerateFaceNormals(boolean generateFaceNormals)

isGenerateFaceLabels

public boolean isGenerateFaceLabels()

setGenerateFaceLabels

public void setGenerateFaceLabels(boolean generateFaceLabels)

isGenerateAABBTree

public boolean isGenerateAABBTree()

setGenerateAABBTree

public void setGenerateAABBTree(boolean generate)

getEdgeCount

public int getEdgeCount()

getLineCount

public int getLineCount()
Deprecated. Use setEdgeCount(int).


setLineCount

public void setLineCount(int count)
Deprecated. Use setEdgeCount(int).


getIndexedLineSet

public IndexedLineSet getIndexedLineSet()

isGenerateEdgeLabels

public boolean isGenerateEdgeLabels()

setGenerateEdgeLabels

public void setGenerateEdgeLabels(boolean generateEdgeLabels)

getVertexCount

public int getVertexCount()

getPointSet

public PointSet getPointSet()

isGenerateVertexLabels

public boolean isGenerateVertexLabels()

setGenerateVertexLabels

public void setGenerateVertexLabels(boolean generateVertexLabels)