/** Returns a copy of this PolygonRoi. */ public synchronized Object clone() { PolygonRoi r = (PolygonRoi) super.clone(); if (xpf != null) { r.xpf = new float[maxPoints]; r.ypf = new float[maxPoints]; } else { r.xp = new int[maxPoints]; r.yp = new int[maxPoints]; } r.xp2 = new int[maxPoints]; r.yp2 = new int[maxPoints]; for (int i = 0; i < nPoints; i++) { if (xpf != null) { r.xpf[i] = xpf[i]; r.ypf[i] = ypf[i]; } else { r.xp[i] = xp[i]; r.yp[i] = yp[i]; } r.xp2[i] = xp2[i]; r.yp2[i] = yp2[i]; } if (xSpline != null) { r.xSpline = new float[splinePoints]; r.ySpline = new float[splinePoints]; r.splinePoints = splinePoints; for (int i = 0; i < splinePoints; i++) { r.xSpline[i] = xSpline[i]; r.ySpline[i] = ySpline[i]; } } return r; }