кусок для подсчета высот

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
if (mouseButton == RIGHT) {
println("right mouse clicked!!!!!!!!!!!!!");
PVectorExt newPoint1 = new PVectorExt(mouseX, mouseY, 20);
final int currentNumberOfTriangles = delaunayTriangulation.numberOfTriangles;
int triangleIndex = 0;
for (triangleIndex = 0; triangleIndex < currentNumberOfTriangles; ++triangleIndex) {
//found triangle which contains newPoint
if (isInsideTriangle(triangleIndex, newPoint1)) {
println("point is in triangle number: " + triangleIndex + ", point: " + newPoint1);
//determing indexes of triangle
break;
}
}
//count height in clicked point
float hcount = countHeightsimple(triangleIndex, newPoint1);
println("height of current dot: " + "x: " + mouseX + " y: " + mouseY + " h: " + hcount);
float meshstep = SCREEN_SIZE/STEP_SIZE;
for (int i = 1; i < (STEP_SIZE); ++i) {
for (int j = 1; j < (STEP_SIZE); ++j) {
//println("matrix x: " + i * meshstep + " y: " + j * meshstep + " h: " + countHeightsimple(triangleIndex, new PVectorExt(i * meshstep, j * meshstep, 20)));
}
}
}
for(int vertexIndex = 0; vertexIndex < delaunayTriangulation.numberOfVertices; ++vertexIndex) {
PVectorExt curVertex = ((PVectorExt)delaunayTriangulation.vertices.get(vertexIndex));
//println("x: " + curVertex.v.x + "y: " + curVertex.v.y + "h: " + curVertex.h);
}