// flatness might need to be calculated, based
// on scale or something. Depends on how many
// points there should be for an accurate
// shape rendition.
float flatness = .25f;
FlatteningPathIterator pi = new FlatteningPathIterator(pi2, flatness);
double[] coords = new double[6];
double pntx = 0;
double pnty = 0;
double pntz = baselineHeight;
HashSet set = new HashSet();
Shape3D shape3D = null;
Debug.message("3detail",
"OMGraphicUtil.createShape3D(): figuring out coordinates");
// Creating the data[]
while (!pi.isDone()) {
int type = pi.currentSegment(coords);
switch (type) {
case PathIterator.SEG_MOVETO:
if (dataIndex != 0) {
shape3D = createShape3D(data,
dataIndex,
stripCount,
color,
filled);
if (shape3D != null) {
set.add(shape3D);
}
data = expandArrayD(bufferSize, null);
dataIndex = 0;
}
case PathIterator.SEG_LINETO:
// SEG_MOVETO is the first point of
// the shape, SEG_LINETO are the
// middle and end points. SEG_CLOSE
// confirms the close, but we don't
// need it.
pntx = coords[0];
pnty = coords[1];
if (Debug.debugging("3detail")) {
Debug.output("Shape coordinates: " + pntx + ", " + pnty);
}
// Get Z here, if you want to set the height of the
// coordinate...
// pntz =
// See if there is space in the buffer.
if (dataIndex >= data.length) {
data = expandArrayD(bufferSize, data);
refreshCounter = bufferSize;
}
data[dataIndex++] = pntx;
data[dataIndex++] = pntz;
data[dataIndex++] = pnty;
// data[dataIndex++] = pntx;
// data[dataIndex++] = pnty;
// data[dataIndex++] = pntz;
stripCount[0]++;
refreshCounter -= 3;
break;
default:
// Do nothing, because it's a repeat
// of the last SEG_LINETO point.
Debug.message("3detail", "Shape coordinates: " + coords[0]
+ ", " + coords[1] + " rounding out SEG_CLOSE");
}
pi.next();
}
if (dataIndex != 0) {
shape3D = createShape3D(data, dataIndex, stripCount, color, filled);
if (shape3D != null) {