*/
private static Shape getElementSubShape(TriElement e, float[] scalar, float thrsh, Map<Edge, Point2f> intPoints){
GeneralPath path = new GeneralPath();
// find first node above threshold
Point2f p = null;
Node2D n = null;
int i;
for (i = 0; i < 3; i++) {
n = e.getNode(i);
if(scalar[n.getIndex()] >= thrsh){
p = n.getPoint2f();
break;
}
}
// no node found --> return empty path
if(p == null)
return path;
path.moveTo(p.x, p.y);
boolean b, prevB = true; // was previous node above thrsh?
Node2D prevN = n;
int end = i + 3;
for (i++; i <= end; i++) {
n = e.getNode(i % 3);
p = n.getPoint2f();
b = scalar[n.getIndex()] >= thrsh;
if(b != prevB){ // edge crosses threshold -> interpolate point
Edge edge = new Edge(prevN, n);
Point2f pInt = intPoints.get(edge);
path.lineTo(pInt.x, pInt.y);
}
if(b){
path.lineTo(p.x, p.y);
}