org.jcae.mesh.amibe.traits
Class MeshTraitsBuilder

java.lang.Object
  extended by org.jcae.mesh.amibe.traits.TraitsBuilder
      extended by org.jcae.mesh.amibe.traits.MeshTraitsBuilder

public class MeshTraitsBuilder
extends TraitsBuilder


Field Summary
 
Fields inherited from class org.jcae.mesh.amibe.traits.TraitsBuilder
attributes, COLOR, index, NORMAL, SCALARFIELD, VECTORFIELD
 
Constructor Summary
MeshTraitsBuilder()
          Constructor.
 
Method Summary
 MeshTraitsBuilder add(TraitsBuilder t)
          Adds VertexTraitsBuilder, HalfEdgeTraitsBuilder or TriangleTraitsBuilder instance to current mesh traits.
 MeshTraitsBuilder addGroupList()
          Adds group list to mesh traits.
 MeshTraitsBuilder addKdTree(int d)
          Adds KdTree instance to mesh traits.
 MeshTraitsBuilder addNodeList()
          Adds node list to mesh traits.
 MeshTraitsBuilder addNodeSet()
          Adds node set to mesh traits.
 MeshTraitsBuilder addTriangleList()
          Adds triangle list to mesh traits.
 MeshTraitsBuilder addTriangleSet()
          Adds triangle set to mesh traits.
 void ensureCapacity(int triangles, Traits t)
          Resizes internal collections of vertices and triangles.
static MeshTraitsBuilder getDefault2D()
          Returns default 2D MeshTraitsBuilder instance.
static MeshTraitsBuilder getDefault3D()
          Returns default 3D MeshTraitsBuilder instance.
 java.util.Collection getGroups(Traits t)
          Returns collection of groups.
 HalfEdgeTraitsBuilder getHalfEdgeTraitsBuilder()
          Returns HalfEdgeTraitsBuilder instance.
 KdTree getKdTree(Traits t)
          Returns KdTree instance.
 java.util.Collection<Vertex> getNodes(Traits t)
          Returns collection of nodes.
 java.util.Collection<Triangle> getTriangles(Traits t)
          Returns collection of triangles.
 TriangleTraitsBuilder getTriangleTraitsBuilder()
          Returns TriangleTraitsBuilder instance.
 VertexTraitsBuilder getVertexTraitsBuilder()
          Returns VertexTraitsBuilder instance.
 boolean hasKdTree()
          Tells whether mesh traits stores a KdTree instance.
 boolean hasNodes()
          Tells whether mesh traits stores collection of nodes.
 boolean hasTriangles()
          Tells whether mesh traits stores collection of triangles.
protected  void subInitTraits(Traits t)
          Dummy method, overridden by subclasses.
 
Methods inherited from class org.jcae.mesh.amibe.traits.TraitsBuilder
addColor, addNormal, addScalarField, addVectorField, createTraits, getColor, getNormal, getScalarField, getVectorField, hasCapability, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MeshTraitsBuilder

public MeshTraitsBuilder()
Constructor.

Method Detail

addTriangleList

public MeshTraitsBuilder addTriangleList()
Adds triangle list to mesh traits.

Returns:
this instance

addTriangleSet

public MeshTraitsBuilder addTriangleSet()
Adds triangle set to mesh traits.

Returns:
this instance

getTriangles

public java.util.Collection<Triangle> getTriangles(Traits t)
Returns collection of triangles.

Parameters:
t - mesh traits
Returns:
collection of triangles

hasTriangles

public boolean hasTriangles()
Tells whether mesh traits stores collection of triangles. This method always returns true because our data structure is based on triangles.

Returns:
true

addNodeList

public MeshTraitsBuilder addNodeList()
Adds node list to mesh traits.

Returns:
this instance

addNodeSet

public MeshTraitsBuilder addNodeSet()
Adds node set to mesh traits.

Returns:
this instance

getNodes

public java.util.Collection<Vertex> getNodes(Traits t)
Returns collection of nodes.

Parameters:
t - mesh traits
Returns:
collection of nodes

hasNodes

public boolean hasNodes()
Tells whether mesh traits stores collection of nodes.

Returns:
true if addNodeList() or addNodeSet() was called, false otherwise.

addGroupList

public MeshTraitsBuilder addGroupList()
Adds group list to mesh traits.

Returns:
this instance

getGroups

public java.util.Collection getGroups(Traits t)
Returns collection of groups.

Parameters:
t - mesh traits
Returns:
collection of groups

addKdTree

public MeshTraitsBuilder addKdTree(int d)
Adds KdTree instance to mesh traits.

Returns:
this instance

getKdTree

public KdTree getKdTree(Traits t)
Returns KdTree instance.

Parameters:
t - mesh traits
Returns:
KdTree instance

hasKdTree

public boolean hasKdTree()
Tells whether mesh traits stores a KdTree instance.

Returns:
true if addKdTree(int) was called, false otherwise.

subInitTraits

protected void subInitTraits(Traits t)
Description copied from class: TraitsBuilder
Dummy method, overridden by subclasses.

Overrides:
subInitTraits in class TraitsBuilder
Parameters:
t - traits

ensureCapacity

public void ensureCapacity(int triangles,
                           Traits t)
Resizes internal collections of vertices and triangles.

Parameters:
triangles - desired number of triangles
t - mesh traits

add

public MeshTraitsBuilder add(TraitsBuilder t)
Adds VertexTraitsBuilder, HalfEdgeTraitsBuilder or TriangleTraitsBuilder instance to current mesh traits.

Parameters:
t - traits builder
Returns:
KdTree instance

getVertexTraitsBuilder

public VertexTraitsBuilder getVertexTraitsBuilder()
Returns VertexTraitsBuilder instance.

Returns:
VertexTraitsBuilder instance

getHalfEdgeTraitsBuilder

public HalfEdgeTraitsBuilder getHalfEdgeTraitsBuilder()
Returns HalfEdgeTraitsBuilder instance.

Returns:
HalfEdgeTraitsBuilder instance

getTriangleTraitsBuilder

public TriangleTraitsBuilder getTriangleTraitsBuilder()
Returns TriangleTraitsBuilder instance.

Returns:
TriangleTraitsBuilder instance

getDefault2D

public static final MeshTraitsBuilder getDefault2D()
Returns default 2D MeshTraitsBuilder instance. This instance calls following methods: addTriangleList(), addKdTree(int) and TriangleTraitsBuilder.addVirtualHalfEdge(). It is implicitly used when calling Mesh2D constructor without MeshTraitsBuilder argument.


getDefault3D

public static final MeshTraitsBuilder getDefault3D()
Returns default 3D MeshTraitsBuilder instance. This instance calls following methods: addTriangleSet() and TriangleTraitsBuilder.addHalfEdge(). It is implicitly used when calling Mesh constructor without MeshTraitsBuilder argument.