de.jreality.geometry
Class FatIndexedFaceSetFactory

java.lang.Object
  extended by de.jreality.geometry.FatIndexedFaceSetFactory

public class FatIndexedFaceSetFactory
extends Object

Fatten an IndexedFaceSet. This factory makes out of one IndexedFaceSet two IndexedFaceSets, top and bottom, by moving the given IndexedFaceSet along its vertex normals "up" and "down" (in this process the length of the vertex normals is not normalized). It may also generate IndexedFaceSets for the boundary. All vertex, edges, and face attributes of the given IndexedFaceSet are copied to the top and bottom IndexedFaceSets. For the boundary this must be handled elsewhere.

The ThickenedSurfaceFactory also fattens a given IndexedFaceSet, but puts everything into one IndexedFaceSet. It is also not flexible at the boundary. On the other hand, the ThickenedSurfaceFactory can make holes into the face, which is not possible with the FatIndexedFaceSetFactory.

Author:
G. Paul Peters, Sep 23, 2009
See Also:
ThickenedSurfaceFactory

Constructor Summary
FatIndexedFaceSetFactory()
           
 
Method Summary
 SceneGraphComponent getAllInOneSceneGraphComponent()
          Returns all components of the fat indexed face set as children of one SceneGraphComponent.
 IndexedFaceSet getBottomIFS()
          The returned reference is final.
 IndexedFaceSetFactory getBottomIFSF()
          The returned reference is final.
 SceneGraphComponent getBottomSGC()
          The returned reference is final.
 List<IndexedFaceSetFactory> getBoundaryIFSFs()
          The returned reference is final.
 List<IndexedFaceSet> getBoundaryIFSs()
          The returned reference is final.
 List<int[]> getBoundaryIndices()
           
 List<SceneGraphComponent> getBoundarySGCs()
          The returned reference is final.
 double getFatness()
           
 IndexedFaceSet getInputIFS()
           
 IndexedFaceSet getTopIFS()
          The returned reference is final.
 IndexedFaceSetFactory getTopIFSF()
          The returned reference is final.
 SceneGraphComponent getTopSGC()
          The returned reference is final.
 void initBoundary(int expectedNbOfBoundaryComponents)
          Use this method to initialize the lists returned by getBoundaryIFSFs(), getBoundaryIFSs(), and getBoundarySGCs().
 boolean isGenerateBoundaryIndices()
           
 void setBoundaryIndices(List<int[]> boundaryIndices)
          Determines the boundary components.
 void setFatness(double fatness)
          The vertex coordinates of the top and bottom IndexedFaceSets are obtained by adding ±½fatness times the vertex normal to the given vertex.
 void setGenerateBoundaryIndices(boolean generateBoundaryIndices)
          Set to true, when the factory should detect the boundary edges.
 void setInputIFS(IndexedFaceSet inputIFS)
          The IndexedFaceSet to be fattened.
 void update()
          Call this to generate the first time or update the components of the fat indexed face set whenever ingredients - in particular the input index face set - change.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FatIndexedFaceSetFactory

public FatIndexedFaceSetFactory()
Method Detail

getInputIFS

public IndexedFaceSet getInputIFS()

setInputIFS

public void setInputIFS(IndexedFaceSet inputIFS)
The IndexedFaceSet to be fattened.

Parameters:
inputIFS -

getFatness

public double getFatness()

setFatness

public void setFatness(double fatness)
The vertex coordinates of the top and bottom IndexedFaceSets are obtained by adding ±½fatness times the vertex normal to the given vertex.

Parameters:
fatness -

isGenerateBoundaryIndices

public boolean isGenerateBoundaryIndices()

setGenerateBoundaryIndices

public void setGenerateBoundaryIndices(boolean generateBoundaryIndices)
Set to true, when the factory should detect the boundary edges. A boundary edge is an edge in the given IndexedFaceSet that does only occur once in the list of face indices of the IndexedFaceSet, i.e., has only one adjacent face. A boundary component is either closed or starts and ends at vertices, that only have two adjacent edges. This leads to correct, i.e., four, boundary components in the case of IndexedFaceSets produced by a QuadMeshFactory.

Parameters:
generateBoundaryIndices -

getBoundaryIndices

public List<int[]> getBoundaryIndices()

setBoundaryIndices

public void setBoundaryIndices(List<int[]> boundaryIndices)
Determines the boundary components.

Parameters:
boundaryIndices - of boundary components. Each entry is an int array, where consecutive indices describe an edge (they point to the start and end vertices of that edge).

initBoundary

public void initBoundary(int expectedNbOfBoundaryComponents)
Use this method to initialize the lists returned by getBoundaryIFSFs(), getBoundaryIFSs(), and getBoundarySGCs(). This is useful when boundary components are to be generated, the number of boundary components is known, but one wants to set properties e.g. of the IndexedFaceSetFactory that generates a boundary component before update() is called. Otherwise it is not necessary to call this method. Then the boundary components are initialized when update() is called.

Parameters:
expectedNbOfBoundaryComponents -

getTopIFS

public IndexedFaceSet getTopIFS()
The returned reference is final.


getBottomIFS

public IndexedFaceSet getBottomIFS()
The returned reference is final.


getBoundaryIFSs

public List<IndexedFaceSet> getBoundaryIFSs()
The returned reference is final. The references in the list only change, when the number of boundary components changes.


getTopIFSF

public IndexedFaceSetFactory getTopIFSF()
The returned reference is final. Change the properties of the returned factory to influence the generation of the top indexed face set.

Returns:
the factory that is used to generate the top indexed face set.

getBottomIFSF

public IndexedFaceSetFactory getBottomIFSF()
The returned reference is final. Change the properties of the returned factory to influence the generation of the bottom indexed face set.

Returns:
the factory that is used to generate the bottom indexed face set.

getBoundaryIFSFs

public List<IndexedFaceSetFactory> getBoundaryIFSFs()
The returned reference is final. The references in the list only change, when the number of boundary components changes. Change the properties of the returned factory to influence the generation of the boundary indexed face sets.

Returns:
the factories that are used to generate the boundary indexed face sets.

getTopSGC

public SceneGraphComponent getTopSGC()
The returned reference is final.

Returns:
the SceneGraphComponent with the top indexed face set as geometry.

getBottomSGC

public SceneGraphComponent getBottomSGC()
The returned reference is final.

Returns:
the SceneGraphComponent with the bottom indexed face set as geometry.

getBoundarySGCs

public List<SceneGraphComponent> getBoundarySGCs()
The returned reference is final. The references in the list only change, when the number of boundary components changes.

Returns:
the list of SceneGraphComponents with the boundary indexed face sets as geometry.

getAllInOneSceneGraphComponent

public SceneGraphComponent getAllInOneSceneGraphComponent()
Returns all components of the fat indexed face set as children of one SceneGraphComponent.


update

public void update()
Call this to generate the first time or update the components of the fat indexed face set whenever ingredients - in particular the input index face set - change.

Throws:
UnsupportedOperationException - when the input index face set (setInputIFS(IndexedFaceSet)) is null, has no faces or no vertex normals.