de.jreality.geometry
Class PointSetFactory

java.lang.Object
  extended by de.jreality.geometry.AbstractGeometryFactory
      extended by de.jreality.geometry.AbstractPointSetFactory
          extended by de.jreality.geometry.PointSetFactory
All Implemented Interfaces:
GeometryFactory

public class PointSetFactory
extends AbstractPointSetFactory

A factory class for creating and updating point sets. See PointSet for details of the underlying point set.

There are different formats which can be used to set this data, and corresponding methods for setting this data. You must first set the number of vertices using setVertexCount(int). Then vertex attributes can be set. For example to set the attribute Attribute.COORDINATES:

In the case the argument is double[] then the length must be length 3 or 4 times the number of vertices. (Point sets can have either ordinary or homogeneouse coordinates). This vector length (3 or 4) is sometimes called the fiber length of the data.

There are analogous methods for setting the built-in attributes normals, colors, texture coordinates, relative radii, and labels. Texture coordinates can have fiber length 2, 3, or 4. Normals in euclidean case must have fiber length 3; otherwise they should have length 4. Labels are represented by an array of type String[].

For attributes not included in the built-in set, use the methods

Each instance of a factory always acts on the same instance of PointSet. To get this instance use the method getPointSet(). To edit the instance, call the various set methods, then call AbstractGeometryFactory.update(). You don't need to call getPointSet() again, as it always returns the same value.

You can also request the factory to automatically generate vertex labels (which are strings displayed as 3D text at the position of the vertices) using the method AbstractPointSetFactory.setGenerateVertexLabels(boolean). This will generate labels showing the index of the point within the point array.

The abstract superclass AbstractPointSetFactory is not visible publicly. It provides protected methods to subclasses. Subclasses such as this one can then decide which of these methods to reveal by implementing them as public methods.

To specify that the geometry should be handled according to non-euclidean metric, use the method AbstractGeometryFactory.setMetric(int). This has little significance for the point sets, but becomes more important for subclasses such as IndexedFaceSetFactory.

This class writes itself For an example, see this tutorial.

See DataList.

Author:
gunn

Constructor Summary
PointSetFactory()
           
 
Method Summary
 PointSet getPointSet()
           
 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 setVertexCoordinates(DataList data)
           
 void setVertexCoordinates(double[] data)
           
 void setVertexCoordinates(double[][] data)
           
 void setVertexCount(int count)
           
 void setVertexLabels(java.lang.String[] data)
           
 void setVertexNormals(DataList data)
           
 void setVertexNormals(double[] data)
           
 void setVertexNormals(double[][] data)
           
 void setVertexRelativeRadii(double[] data)
           
 void setVertexTextureCoordinates(DataList data)
           
 void setVertexTextureCoordinates(double[] data)
           
 void setVertexTextureCoordinates(double[][] data)
           
 
Methods inherited from class de.jreality.geometry.AbstractPointSetFactory
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

PointSetFactory

public PointSetFactory()
Method Detail

setVertexCount

public void setVertexCount(int count)
Overrides:
setVertexCount in class AbstractPointSetFactory

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)

setVertexNormals

public void setVertexNormals(DataList 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(java.awt.Color[] 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)

setVertexLabels

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

setVertexRelativeRadii

public void setVertexRelativeRadii(double[] data)

getPointSet

public PointSet getPointSet()
Overrides:
getPointSet in class AbstractPointSetFactory