org.jcae.mesh.amibe.patch
Class Mesh2D

java.lang.Object
  extended by org.jcae.mesh.amibe.ds.Mesh
      extended by org.jcae.mesh.amibe.patch.Mesh2D
All Implemented Interfaces:
java.io.Serializable

public class Mesh2D
extends Mesh

Mesh data structure for parameterized surfaces. Connectivity between triangles and vertices is inherited from Mesh, and a KdTree instance added in order to speed up finding the nearest Vertex2D V from any given point V0.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.jcae.mesh.amibe.ds.Mesh
factory, maxLabel, meshParameters, outerTrianglesAreConnected, outerVertex, traits, traitsBuilder
 
Constructor Summary
Mesh2D()
          Sole constructor.
Mesh2D(CADShape f)
           
Mesh2D(MeshTraitsBuilder mtb)
           
Mesh2D(MeshTraitsBuilder mtb, MeshParameters mp, CADShape f)
          Creates an empty mesh bounded to the topological surface.
 
Method Summary
 void bootstrap(Vertex2D v0, Vertex2D v1, Vertex2D v2)
          Bootstraps node instertion by creating the first triangle.
 Calculus compGeom()
          Returns metrics dimension.
 double distance2(Vertex start, Vertex end, Vertex vm)
          Returns Riemannian square distance between nodes.
 VirtualHalfEdge2D forceBoundaryEdge(Vertex2D start, Vertex2D end, int maxIter)
          Enforces an edge between two points.
 double[] getBounds(Vertex v)
          Returns the 2D radius of the 3D unit ball centered at a point.
 CADShape getGeometry()
          Returns the topological face.
 CADGeomSurface getGeomSurface()
          Returns the geometrical surface.
 java.util.Collection<Vertex> getNodes()
          Returns vertex list.
 boolean isValid(boolean constrained)
          Checks whether this mesh is valid.
 Calculus popCompGeom()
          Resets metrics dimension.
 Calculus popCompGeom(int i)
          Resets metrics dimension.
 void pushCompGeom(int i)
          Sets metrics dimension.
 
Methods inherited from class org.jcae.mesh.amibe.ds.Mesh
add, add, buildAdjacency, buildAdjacency, canCollapseEdge, createTetrahedron, createTriangle, createTriangle, createTriangle, createVertex, createVertex, createVertex, edgeCollapse, edgeSwap, ensureCapacity, getKdTree, getMeshParameters, getTriangles, hasAdjacency, hasNodes, isValid, remove, remove, resetKdTree, setRefVertexOnboundary, vertexSplit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Mesh2D

public Mesh2D()
Sole constructor.


Mesh2D

public Mesh2D(MeshTraitsBuilder mtb)

Mesh2D

public Mesh2D(MeshTraitsBuilder mtb,
              MeshParameters mp,
              CADShape f)
Creates an empty mesh bounded to the topological surface. This constructor also initializes tolerance values. If length criterion is null, MeshParameters.setLength(double) is called with the diagonal length of face bounding box as argument. If MeshParameters.epsilon is not set, epsilon is computed as being the maximal value between length criterion by 100 and diagonal length by 1000.

Parameters:
f - topological surface

Mesh2D

public Mesh2D(CADShape f)
Method Detail

getGeometry

public CADShape getGeometry()
Returns the topological face.

Returns:
the topological face.

getGeomSurface

public CADGeomSurface getGeomSurface()
Returns the geometrical surface.

Returns:
the geometrical surface.

getNodes

public java.util.Collection<Vertex> getNodes()
Returns vertex list. Note that this class does not rely on MeshTraitsBuilder, but call KdTree.getAllVertices(int).

Overrides:
getNodes in class Mesh
Returns:
vertex list.

bootstrap

public void bootstrap(Vertex2D v0,
                      Vertex2D v1,
                      Vertex2D v2)
Bootstraps node instertion by creating the first triangle. This initial triangle is counter-clockwise oriented, and outer triangles are constructed.

Parameters:
v0 - first vertex.
v1 - second vertex.
v2 - third vertex.

forceBoundaryEdge

public VirtualHalfEdge2D forceBoundaryEdge(Vertex2D start,
                                           Vertex2D end,
                                           int maxIter)
                                    throws InitialTriangulationException
Enforces an edge between two points. This routine is used to build constrained Delaunay meshes. Intersections between existing mesh segments and the new segment are computed, then edges are swapped so that the new edge is part of the mesh.

Parameters:
start - start point.
end - end point.
maxIter - maximal number of iterations.
Returns:
a handle to the newly created edge.
Throws:
InitialTriangulationException - if the boundary edge cannot be enforced.

pushCompGeom

public void pushCompGeom(int i)
Sets metrics dimension. Metrics operations can be performed either on 2D or 3D Euclidien spaces. The latter is the normal case, but the former can also be used, e.g. when retrieving boundary edges of a constrained mesh. Argument is either 2 or 3, other values

Parameters:
i - metrics dimension.
Throws:
java.lang.IllegalArgumentException - If argument is neither 2 nor 3, this exception is raised.

popCompGeom

public Calculus popCompGeom()
Resets metrics dimension.

Returns:
metrics dimension.
Throws:
java.lang.IllegalArgumentException - If argument is neither 2 nor 3, this exception is raised.

popCompGeom

public Calculus popCompGeom(int i)
                     throws java.lang.RuntimeException
Resets metrics dimension. Checks that the found metrics dimension is identical to the one expected.

Parameters:
i - expected metrics dimension.
Returns:
metrics dimension.
Throws:
java.lang.RuntimeException - If argument is different from metrics dimension.

compGeom

public Calculus compGeom()
Returns metrics dimension.

Returns:
metrics dimension.

distance2

public double distance2(Vertex start,
                        Vertex end,
                        Vertex vm)
Returns Riemannian square distance between nodes.

Overrides:
distance2 in class Mesh
Parameters:
start - the start node
end - the end node
vm - the vertex on which metrics is evaluated
Returns:
square distance between nodes

getBounds

public double[] getBounds(Vertex v)
Returns the 2D radius of the 3D unit ball centered at a point. This routine returns a radius such that the 2D circle centered at a given vertex will have a distance lower than 1 in 3D. This method is used by KdTree.getNearestVertex(org.jcae.mesh.amibe.ds.Mesh, org.jcae.mesh.amibe.ds.Vertex)

Overrides:
getBounds in class Mesh
Parameters:
v - the vertex on which metrics is evaluated
Returns:
the radius in 2D space.

isValid

public boolean isValid(boolean constrained)
Description copied from class: Mesh
Checks whether this mesh is valid. This routine can be called at any stage, even before boundary edges have been enforced. In this case, some tests must be removed because they do not make sense.

Overrides:
isValid in class Mesh
Parameters:
constrained - true if mesh is constrained.