/** * Get Z value of a specific point in the triangle Take into account triangles connected to the * edge * * @param aPoint * @return ZValuei */ public final double softInterpolateZ(DPoint aPoint) { double weight = (double) PT_NB; double zValue = interpolateZ(aPoint) * weight; // Process connected edges for (int i = 0; i < PT_NB; i++) { DEdge anEdge = edges[i]; DTriangle aTriangle = null; if (anEdge != null) { if (anEdge.getLeft() == this) { aTriangle = anEdge.getRight(); } else { aTriangle = anEdge.getLeft(); } } if (aTriangle != null) { weight += 1.0; zValue += aTriangle.interpolateZ(aPoint); } } // Define new Z value zValue /= weight; return zValue; }