I am trying to calculate delaunay triangles using the following process:
• x,y data is projected onto the paraboloid z = x
2 + y
2
• The triple (i, j, k) contains the nodes of a potential triangle. Then have to test all possible combinations of triples.
• Loop over i while i<n-2
• Loop over j = i+1 while i<n
• Loop over k = i+1 while i<n
• If j≠k:
o Compute the normal to the triangle (i, j, k)
o If the normal is oriented in a positive z direction then: (this prevents checking triangles twice in two directions – clockwise and anti clockwise). Then:
Check the dot product of the normal to the triangle with all other nodes.
If the dot product is positive (or greater than the machine tolerance which is 3-8 for a 32 bit machine) for all nodes, then the triangle is a Delaunay triangle.
where:
Vec is a 3D vector class,
zMap is the sum of the x, y components of nodeVec (of Vec type) squared
1 2 3 4 5 6 7 8 9 10 11 12
|
void triangulate(vector <Vec*> nodeVec, vector <double> zMap, List& triList){
for (unsigned int i = 0; i < nodeVec.size(); i++){
for (unsigned int j = i+1; j < nodeVec.size(); j++){
for (unsigned int k = i+1; k < nodeVec.size(); k++){
if ( j != k ){
}
}
}
}
}
|
I just cant get my head around the problem and need help!