public static Vertices createVertices(final float[] x, final float[] y, final boolean copyArrays) { return new DefaultVertices(x, y, copyArrays); }
@Override public void add(final double x, final double y) { vertices.add((float)x, (float)y); }
@Override public void clear() { vertices.clear(); }
void close() { // // If we have a single value, duplicate it for closing // if (size == 1) { // ensureCapacity(2); // x[size] = this.x[0]; // y[size] = this.y[0]; // size++; // } // else if (size > 1) { if (x[0] != x[size-1] || y[0] != y[size-1]) { ensureCapacity(size+1); x[size] = this.x[0]; y[size] = this.y[0]; size++; } } compact(); }
void add(final float x, final float y) { if (size == this.x.length) ensureCapacity(size + 16); this.x[size] = x; this.y[size] = y; size++; }
@Override public float[] getX(float[] xArray) { return getArray(x, xArray); }
@Override public void close() { vertices.close(); }
@Override public void compact() { vertices.compact(); }
@Override public List<Point2> getPoints() { return vertices.getPoints(); }
@Override public Point2 get(int idx) { return vertices.get(idx); }
@Override public Vertices duplicate() { return new DefaultMutableVertices((DefaultVertices)vertices.duplicate()); }
@Override public void ensureCapacity(final int capacity) { vertices.ensureCapacity(capacity); }
@Override public float[] getY(float[] yArray) { return getArray(y, yArray); }
public static DefaultVertices createVertices(final int capacity) { return new DefaultVertices(capacity); }
@Override public void add(final float x, final float y) { vertices.add(x, y); }
@Override public Vertices duplicate() { DefaultVertices v = new DefaultVertices(x.length); v.x = Arrays.copyOf(x, x.length); v.y = Arrays.copyOf(y, x.length); v.size = size; return v; }
public static DefaultMutableVertices createMutableVertices(final int capacity) { return new DefaultMutableVertices(new DefaultVertices(capacity)); }
public static MutableVertices createMutableVertices(final float[] x, final float[] y, final boolean copyArrays) { return new DefaultMutableVertices(new DefaultVertices(x, y, copyArrays)); }
AreaROI(float[][] x, float[][] y, int c, int z, int t) { super(c, z, t); this.vertices = new ArrayList<>(); if (x.length != y.length) throw new IllegalArgumentException("Lengths of x and y are different!"); for (int i = 0; i < x.length; i++) { float[] x2 = x[i]; float[] y2 = y[i]; if (x.length != y.length) throw new IllegalArgumentException("Lengths of x and y are different!"); this.vertices.add(new DefaultMutableVertices(new DefaultVertices(x2, y2, false))); } }
DefaultMutableVertices(final Vertices vertices) { this.vertices = new DefaultVertices(vertices.getX(null), vertices.getY(null), false); }