// VectorSSI - SSI with straight line segments persistable sclass VectorSSI extends AbstractSSI { replace X with short. replace Y with short. replace toX with toShort_enforce. replace toY with toShort_enforce. replace newXArray with newShortArrayOrNull. // core values (mandatory): first column and row occupied settable X x1; settable Y y1; // Curves of x start and x end, relative to (x1, y1) // Both have same length settable InterpolatedDoubleArray leftCurve; settable InterpolatedDoubleArray rightCurve; *(SSI ssi) { Rect r = ssi.bounds(); x1(toX(r.x1())); y1(toY(r.y1())); int h = r.h(); int[] left = new int[h], right = new int[h]; for y to h: { left[y] = ssi.getLeft(y1+y)-x1; right[y] = ssi.getRight(y1+y)-x1; } leftCurve(CompressToInterpolatedDoubleArray(left)!); rightCurve(CompressToInterpolatedDoubleArray(right)!); } int height aka h() { ret leftCurve.length(); } int y2() { ret y1+h(); } SSI toSSI aka get() { int h = h(); var ssi = new SSI(y1, y2()); int[] left = leftCurve.rounded(); int[] right = rightCurve.rounded(); for y to h: ssi.set(y1+y, x1+left[y], x1+right[y]); ret ssi; } }