org.jcae.mesh.amibe.algos2d
Class Insertion

java.lang.Object
  extended by org.jcae.mesh.amibe.algos2d.Insertion

public class Insertion
extends java.lang.Object

Insert nodes to produce a unit mesh. Process all edges; if an edge is longer than sqrt(2), candidate vertices are added to a bucket to virtually provide unit length subsegments. The next step is to take vertices from the bucket in random order. For each vertex v, the closest vertex w already present in the mesh is returned by KdTree.getNearestVertex(Mesh, Vertex) If the distance between v and w is lower than 1/sqrt(2), v is dropped, otherwise it is inserted into the mesh. Just after a vertex is inserted, incident edges are swapped if they are not Delaunay. The whole process is repeated until no new vertex is added.

If all vertices of an edge were inserted at the same time, adjacent edges may get in trouble because their candidate vertices could be too near from these points. In order to avoid this problem, vertices are processed in a random order so that all edges have a chance to be splitted. As we want reproducible meshes, a pseudo-random order is preferred.

Triangle centroids are also inserted if they are not too near of existing vertices. This was added to try to improve triangle quality, but is a bad idea. Bad triangles should instead be sorted (with PAVLSortedTree) and their circumcenter added to the mesh if the overall quality is improved,

The AbstractHalfEdge.MARKED flag has two purposes: half-edges must be processed once, and when a small edge has been found, it will never be processed, so there is no need to compute its length again and again. By convention, if an half-edge and its symmetric half-edge has both been tagged with AbstractHalfEdge.MARKED, this means that this edge is small. If either an half-edge ot its symmetric half-edge is tagged, this edge has already been processed.


Constructor Summary
Insertion(Mesh2D m)
          Creates a Insertion instance.
Insertion(Mesh2D m, double scale)
           
 
Method Summary
 void compute()
          Iteratively insert inner nodes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Insertion

public Insertion(Mesh2D m)
Creates a Insertion instance.

Parameters:
m - the Mesh2D instance to refine.

Insertion

public Insertion(Mesh2D m,
                 double scale)
Method Detail

compute

public void compute()
Iteratively insert inner nodes.