float squareflat; // Square of the flatness parameter // for testing against squared lengths
int limit; // Maximum number of recursion levels
float hold[] = newfloat[14]; // The cache of interpolated coords // Note that this must be long enough // to store a full cubic segment and // a relative cubic segment to avoid // aliasing when copying the coords // of a curve to the end of the array. // This is also serendipitously equal // to the size of a full quad segment // and 2 relative quad segments.
int holdEnd; // The index of the last curve segment // being held for interpolation
int holdIndex; // The index of the curve segment // that was last interpolated. This // is the curve segment ready to be // returned in the next call to // currentSegment().
int levels[]; // The recursion level at which // each curve being held in storage // was generated.
int levelIndex; // The index of the entry in the // levels array of the curve segment // at the holdIndex
// Now that we have subdivided, we have constructed // two curves of one depth lower than the original // curve. One of those curves is in the place of // the former curve and one of them is in the next // set of held coordinate slots. We now set both // curves level values to the next higher level.
level++;
levels[levelIndex] = level;
levelIndex++;
levels[levelIndex] = level;
}
// This curve segment is flat enough, or it is too deep // in recursion levels to try to flatten any more. The // two coordinates at holdIndex+4 and holdIndex+5 now // contain the endpoint of the curve which can be the // endpoint of an approximating line segment.
holdIndex += 4;
levelIndex--; returntrue;
}
publicstaticvoid main(String argv[]) {
verbose = (argv.length > 0); for (int i = 0; i < 100000; i++) {
Test7047069 st = new Test7047069(); while (st.next()) {}
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.