delaunay triangulation from 2-d delaunay to 3-d delaunay

37
Delaunay Triangulation - From 2-D Delaunay to 3-D Delaunay Wang Jing School of Physical and Mathematical Sciences Nanyang Technological University

Upload: greentask

Post on 12-Jul-2015

352 views

Category:

Science


6 download

TRANSCRIPT

Page 1: Delaunay triangulation   from 2-d delaunay to 3-d delaunay

Delaunay Triangulation

- From 2-D Delaunay to 3-D Delaunay

Wang Jing

School of Physical and Mathematical Sciences

Nanyang Technological University

Page 2: Delaunay triangulation   from 2-d delaunay to 3-d delaunay

Outline

Page 3: Delaunay triangulation   from 2-d delaunay to 3-d delaunay

The computation of the coordinate of a triangle

Use base and new point to find cavity

Complexity

Some discusses about the program

Function: double circumcenterx double circumcentery

Function: int determine int findcavity

(1)Some other thoughts about the program (2)Some improvement of the program

The analysis of comlexity

Use matlab to draw some graphs using the generated points

Ⅶ From 2-D delaunay to 3-D delaunay

1

122

133

144

155 166 176

Ⅵ Some other knowledge in this paper and related papers

Page 4: Delaunay triangulation   from 2-d delaunay to 3-d delaunay

Ⅰ The first part is to find the circumcenter of a triangle

Cartesian coordinates

If coordinates of the three vertexes of a triangle is A, B, C then the coordinates of ABC’s circumcenter is:

Page 5: Delaunay triangulation   from 2-d delaunay to 3-d delaunay

When

The the coordinate circumcenter is:

Page 6: Delaunay triangulation   from 2-d delaunay to 3-d delaunay

double circumcenterx(double a1,double a2,double b1,double b2,double c1,double c2) // find x of circumcenter of triangle ABC for vertex A(a1,a2), B(b1,b2), C(c1,c2) { double d,e,m; double x,y;// (x,y) is circumcenter d=((pow(a2,2)+pow(a1,2))*(b2-c2)+(pow(b2,2)+pow(b1,2))*(c2-a2)+(pow(c2,2)+pow(c1,2))*(a2-b2)); e=((pow(a2,2)+pow(a1,2))*(c1-b1)+(pow(b2,2)+pow(b1,2))*(a1-c1)+(pow(c2,2)+pow(c1,2))*(b1-a1)); m=2*(a1*(b2-c2)+b1*(c2-a2)+c1*(a2-b2)); x=d/m; y=e/m; return x; }

The function of circumcenter of x coordinate is: (coordinate of y is the same thing, just return y is the function)

Page 7: Delaunay triangulation   from 2-d delaunay to 3-d delaunay

Ⅱ The second part is to find the cavity of a triangle

Using two functions : int findcavity(double m, double n) int determine(int e1,int e2,double m,double n) A

B C

P The new point is P Its coordinate is (m,n). Base is triangle ABC

Page 8: Delaunay triangulation   from 2-d delaunay to 3-d delaunay

There are several parameters in the part: nc: the number of cavity ne: the number of new edges that can form ball cavity[i]: to check whether one triangle has been went through cavitypo[i]: to remember the triangles which are cavities

Some temporary parameters: ex: int e1=tri[base][1]; int e2=tri[base][2]; int e3=tri[base][3]; int t1=edge[e2][e1]; int t2=edge[e3][e2]; int t3=edge[e1][e3];

Page 9: Delaunay triangulation   from 2-d delaunay to 3-d delaunay
Page 10: Delaunay triangulation   from 2-d delaunay to 3-d delaunay

The program about deciding whether a triangle is cavity is:

int et11,et12,et13; et11=tri[t1][1]; et12=tri[t1][2]; et13=tri[t1][3]; x=circumcenterx( point[et11][1], point[et11][2], point[et12][1], point[et12][2], point[et13][1], point[et13][2]); //the coordinate x of triangle t1 y=circumcentery( point[et11][1], point[et11][2], point[et12][1], point[et12][2], point[et13][1], point[et13][2]); //the coordinate y of triangle t1 r=sqrt(pow(point[et11][1]-x,2)+pow(point[et11][2]-y,2)); //r of triangle t1 d=sqrt(pow(m-x,2)+pow(n-y,2)); //distance of circumcenter and point(m,n);

if(d<=r+err) //is triangle is a cavity

Page 11: Delaunay triangulation   from 2-d delaunay to 3-d delaunay

Insert a new point P(m,n)

Find cavity through three edge AB, BC, CA

Cavity[i] is a temporary variable, if a triangle have been went through, cavity[i] is 1, else cavity[i] is 0.

If cavity[i] and triangle is existing, the triangle will be checked,

iterate the progress until a triangle is not a cavity or there are no triangles existing.

The main steps are as following:

Page 12: Delaunay triangulation   from 2-d delaunay to 3-d delaunay

We first use the left graph to look the steps. //for the trangle which is a base first innitalize base is cavity[1] .

Page 13: Delaunay triangulation   from 2-d delaunay to 3-d delaunay

int findcavity(double m, double n) // this function is when insert a point(m,n), to find the cavities of point(m,n) { for(int i=0;i<=10000;i++) cavity[i]=0; for(int i=0;i<=5000;i++) { cavitypo[i]=0; edgepoint[i][1]=0; edgepoint[i][2]=0; }//initialize

cavity[base]=1; nc=1; ne=0; cavitypo[1]=base; //nc is the number of ball, ne is the number of new edge with point(m,n)that form new ball

For function findcavity:

Page 14: Delaunay triangulation   from 2-d delaunay to 3-d delaunay

For function determine, we will use iterate:

if(d<=r+err) //is triangle is a cavity { nc=nc+1; cavitypo[nc]=t1; // the number of cavity add 1, and this cavity is t1 if(ed1==e2) // for triangle t1, when t1 is neighboring e1e2 with edge ed3ed1 //we will find cavity from edge ed2ed3, ed1ed2 { tria1=edge[ed3][ed2]; if(tri[tria1]>0&&cavity[tria1]==0) { determine(ed2,ed3,m,n); } tria2=edge[ed1][ed3]; if(tri[tria2][1]>0&&cavity[tria2]==0) { determine(ed3,ed1,m,n); }

Page 15: Delaunay triangulation   from 2-d delaunay to 3-d delaunay

After finding all the cavity, we need to find ball now:

Cavitypo[1]

Cavitypo[2]

Cavitypo[3]

Cavitypo[nc]

……

Cavitypo[2]

Cavitypo[3]

Cavitypo[n]

..….

Page 16: Delaunay triangulation   from 2-d delaunay to 3-d delaunay

ne = nc + 2 ; int test = 1; int k=1; int boundary[10000][3];

Cavitypo[3]

Cavitypo[4]

Cavitypo[n]

……

If two triangles have the same edge, then the edge can’t form ball with new point P, else the edge can form ball with new point P The following is the program about forming ball:

Page 17: Delaunay triangulation   from 2-d delaunay to 3-d delaunay

for(int i=1; i<=nc; i++){ for(int j=1;j<=3;j++){ test = 1; for(int s=1; s<=nc; s++){ for(int t = 1; t<=3;t++){ if((tri[cavitypo[i]][j%3+1]==tri[cavitypo[s]][(t+1)%3+1])&&(tri[cavitypo[i]][(j+1)%3+1]==tri[cavitypo[s]][t%3+1])) test = 0; } } if(test == 1){ ball[k][1] = tri[cavitypo[i]][j%3+1]; ball[k][2] = tri[cavitypo[i]][(j+1)%3+1]; ball[k][3] = np; k = k+1; } } }

Page 18: Delaunay triangulation   from 2-d delaunay to 3-d delaunay

Ⅲ The complexity about this program

For circumcenter the complexity of inserting a new point is n(nt), nt is the triangle has been existing

For the function determine the complexity is at most 2*(nc+1) But for finding ball, it will compute 9*nc(nc-1)/2 times for every new inserted point

Page 19: Delaunay triangulation   from 2-d delaunay to 3-d delaunay

Ⅳ For the program about finding edges that form ball, we can improve the program: That is the time we find cavity, we will record the edges of the triangle we checked.

(1) First for the base

ne=ne+1; edgepoint[ne][1]=e1; edgepoint[ne][2]=e2; ball[ne][1]=e1; ball[ne][2]=e2; ball[ne][3]=np; //for the trangle which is a base first innitalize edge e1e2 as an edge that can form ball with point(m.n)

We will first record the three edges of the base

Page 20: Delaunay triangulation   from 2-d delaunay to 3-d delaunay

(2) If the triangle outside the edge is cavity, we will delete this edge

while(tri[t1][1]>0&&cavity[t1]==0) { ne=ne-1; edgepoint[ne+1][1]=0; edgepoint[ne+1][2]=0; ball[ne+1][1]=0; ball[ne+1][2]=0; ball[ne+1][3]=0; determine(e1,e2,m,n); //if for edge e1e2, the cavity neighboring base is existing the e1e2 may not is a edge that can form ball //since edge that form ball may the edge out of e1e2. //the function of determine is to find the cavity and ball outside of edge e1e2 if given edge e1e2 and point (m,n) }

Page 21: Delaunay triangulation   from 2-d delaunay to 3-d delaunay

(3) Check all the edges have been recorded, if new edge has been existing, we will delete this edge

for(int j=0;j<=ne;j++) { if(edgepoint[j][2]==ed2&&edgepoint[j][1]==ed3) { ne=ne-1; edgepoint[ne+1][1]=0; edgepoint[ne+1][2]=0; ball[ne+1][1]=0; ball[ne+1][2]=0; ball[ne+1][3]=0; deter=1; // when the edge that with point(m,n) can form ball ; if the edge is already exist, we need //to delete this edge and the number if ball will delete 1 }

Page 22: Delaunay triangulation   from 2-d delaunay to 3-d delaunay

Else record

if(deter!=1) { ne=ne+1; edgepoint[ne][1]=ed2; edgepoint[ne][2]=ed3; ball[ne][1]=ed2; ball[ne][2]=ed3; ball[ne][3]=np; // when the edge that with point(m,n) can form ball ; if the edge is not already exist, we need //to add this edge and the number of ball will add 1, the following is the same }

Page 23: Delaunay triangulation   from 2-d delaunay to 3-d delaunay

Ⅴ The programs inputted in matlab

Page 24: Delaunay triangulation   from 2-d delaunay to 3-d delaunay

(1) Graphs generated by matlab

Page 25: Delaunay triangulation   from 2-d delaunay to 3-d delaunay
Page 26: Delaunay triangulation   from 2-d delaunay to 3-d delaunay

Ⅵ Some other knowledge in this paper and related papers

(1) Edge subdivision

Since we have the following equation

Page 27: Delaunay triangulation   from 2-d delaunay to 3-d delaunay

(2)Mesh improvement

(a)Mesh relaxation

Let k1 and k2 be two adjacent triangles containing edge F, constituting a convex polygon. Let(d1, d2, d3, d4) be the vertex of these triangles as in figure blow. The relaxation index R associated with the edge F is defined by:

For boundary vertex, the degree is defined as:

Page 28: Delaunay triangulation   from 2-d delaunay to 3-d delaunay

(b) Mesh smoothing

1

2

3

Page 29: Delaunay triangulation   from 2-d delaunay to 3-d delaunay

(3) A frontal approach for internal node generation

In the advancing front method, an initial list of frontal faces between boundary nodes that represents the boundaries of the domain is established. The smallest face from all fronts is taken as the base of a triangle to be formed. An ideal third node to close the triangle is constructed, in accordance with parameters interpolated on a background mesh that the user specifies. All the other nodes of the existing triangulation that are within a certain radius from the new node are placed in a list, sorted b distance.

(a)Delaunay triangulation

A delaunay triangulation uses a node cloud that is already given and a dissection of the domain into Voronoi regions. Each node is surrounded by its Voronoi region that comprises that part of the plane which is closer to this node that to any other node. The set of boundaries between Voronoi regions is called the Dirichlet tesselation and consists of straight line segments that are equidistant from the two nodes that are closest to each other across that line.

Page 30: Delaunay triangulation   from 2-d delaunay to 3-d delaunay

(b) Fontal node generation

Detect all bad triangles in the grid and find their short faces Find a set of nodes to form nice triangles with the short faces

Check whether the new nodes are not too close to any other node already introduced into the structure

Check whether the new nodes are not too close to any other new node

Retriangulate with the set of new nodes

(c) Node construction

The ideal node to be placed in the mesh would satisfy the distance criterion with all neighboring nodes, ex: the distance to all nodes that it will be connected to equals the background spacing evaluated at the mid point between these two. Clearly, this is an ill-posed problem. But even trying to satisfy the distance condition with the two nodes of the frontal face leads to a system of two quadratic equations.

Page 31: Delaunay triangulation   from 2-d delaunay to 3-d delaunay

(i) The short faces of these acute cells denote a frontier between the region with nice cells and the region still waiting to be refined, as the following figure

Page 32: Delaunay triangulation   from 2-d delaunay to 3-d delaunay

(ii) The front consists of the interface between the region of properly refined triangles and the unrefined region. A refinement should only take place on a face that has a refinable triangle on one side and an unrefinable one on the oter. The following Figure shows the two nodes that would be formed from the two short faces in the front of the obtuse triangle and the node from the face of the acute triangle that neighboring the obtuse one.

Page 33: Delaunay triangulation   from 2-d delaunay to 3-d delaunay

We approximate the length of the sides l1 and l2 opposite to nodes 1 and 2 by 2/ √3l where the altitude l is as found in an equilateral triangle. Requiring that this approximated side length equals the desired spacing h4 evaluated midway between node 3 and the midpoint of the base.

Page 34: Delaunay triangulation   from 2-d delaunay to 3-d delaunay

(1)In the Delaunay mesh of the bounding box of the cavity, the original surface triangulation of the cavity geometry may not all be present, as depicted in the following figure. The could be missing faces and missing edges of the cavity surface in the 3D case.

Ⅶ From 2-D delaunay to 3-D delaunay

Page 35: Delaunay triangulation   from 2-d delaunay to 3-d delaunay

One way to recover the geometry of the original cavity is to perform specific split operations at the intersections of Delaunay mesh entities and missing cavity entities .The volume mesh of the cavity mesh is needed to ecover a missing edge . There is actually one more step which uses collapse operations to represent each missing face with the least number of faces in the cavity mesh.

After the recovery of the surface triangulation via the application of split and collapse operations, the tetrahedra of the cavity mesh outside the cavity are deleted. The deletion requires the classification of cavity mesh entities.

To complete the meshing process, the cavity mesh must be merged into the

volume mesh. A successful merge operation requires an identical match between the cavity boundary of the original volume mesh and the cavity mesh. Two different approaches are developed for the purpose; normal splits followed by planar edge swaps and complex splits which are performed on the original volume mesh.

The cavity mesh and the volume mesh can be merged, resulting in a valid mesh

of the entire domain .

Page 36: Delaunay triangulation   from 2-d delaunay to 3-d delaunay

(2)Delaunay vertex insertion (a)The initial bounding box triangulation is based on a six tetrahedra template. Each vertex of the cavity boundary is inserted into the convex bounding box triangulation by first finding the tetrahedron containing the vertex. The vertex is localized by traveling through face connected regions. To speed up the searching process,, the bounding box is divided into a rectangular grid . This division is saved in a separate date structure where each 3-D rectangular cell contains a vertex. The bounding box meshing of two example cavities by Delaunay vertex insertions are depicted in following figure.

Page 37: Delaunay triangulation   from 2-d delaunay to 3-d delaunay

(b) The visibility and the emptiness of the Delaunay cavity is checked and modified if it is needed by shrinking the cavity before the reconnection process. Theses checks are crucial for the robustness of the Delaunay triangulation. Correction of the Delaunay cavity is required to prevent the formation of invalid regions which may result from the numerical sensitivity of the Delaunay triangulations. The Delaunay cavity shown I the following Figure(a) has all of its vertices on a sphere. The cavities formed from the regions whose circumspheres. Contain the vertex to be inserted ate the centre of the sphere. Some of the cavity faces are not visible to this vertex. The reconnection process may result in invalid regions if the cavity is not made visible to the vertex. Therefore, The visibility is conserved by shrinking the cavity ass depicted in the following Figure(b).