if (p1.getVertices().length == 0 || p2.getVertices().length == 0) { return false; if (overlap.getVertices().length == floatArray2.size) System.arraycopy(floatArray2.items, 0, overlap.getVertices(), 0, floatArray2.size); else overlap.setVertices(floatArray2.toArray());
if (p1.getVertices().length == 0 || p2.getVertices().length == 0) { return false; if (overlap.getVertices().length == floatArray2.size) System.arraycopy(floatArray2.items, 0, overlap.getVertices(), 0, floatArray2.size); else overlap.setVertices(floatArray2.toArray());
verts = intersectionPoly.getVertices(); if(verts.length > 0) { parts.add(snapToGrid(verts));
verts = intersectionPoly.getVertices(); if(verts.length > 0) { parts.add(snapToGrid(verts));
public static String toStringParam(Polygon p) { StringBuilder sb = new StringBuilder(); float[] verts = p.getVertices(); sb.append(verts[0]); for (int i = 1; i < verts.length; i++) { sb.append(NUMBER_PARAM_SEPARATOR); sb.append(verts[i]); } return sb.toString(); }
public static void deletePoint(Polygon poly, int index) { float verts[] = poly.getVertices(); if (verts.length < 8) return; int length = verts.length; float destination[] = new float[length - 2]; // index = index * 2; System.arraycopy(verts, 0, destination, 0, index); System.arraycopy(verts, index + 2, destination, index, length - index - 2); poly.setVertices(destination); }
public static void addPoint(Polygon poly, float x, float y, int index) { float verts[] = poly.getVertices(); x -= poly.getX(); y -= poly.getY(); int length = verts.length; float destination[] = new float[length + 2]; System.arraycopy(verts, 0, destination, 0, index); destination[index] = x; destination[index + 1] = y; System.arraycopy(verts, index, destination, index + 2, length - index); poly.setVertices(destination); }
@Override public void write(Json json) { BladeJson bjson = (BladeJson) json; if (bjson.getMode() == Mode.MODEL) { PolygonUtils.ensureClockWise(bbox.getVertices(), 0, bbox.getVertices().length); bbox.dirty(); } super.write(json); } }
@Override public void write(Json json) { BladeJson bjson = (BladeJson) json; if (bjson.getMode() == Mode.MODEL) { PolygonUtils.ensureClockWise(bbox.getVertices(), 0, bbox.getVertices().length); bbox.dirty(); } super.write(json); } }
private void computeBbox() { if (bbox == null) return; if (bbox.getVertices() == null || bbox.getVertices().length != 8) { bbox.setVertices(new float[8]); } float[] verts = bbox.getVertices(); verts[0] = -getWidth() / 2; verts[1] = 0f; verts[2] = -getWidth() / 2; verts[3] = getHeight(); verts[4] = getWidth() / 2; verts[5] = getHeight(); verts[6] = getWidth() / 2; verts[7] = 0f; bbox.dirty(); }
@Override public void undo() { float verts[] = a.getBBox().getVertices(); verts[i] = pos.x; verts[i + 1] = pos.y; a.getBBox().dirty(); Ctx.project.setModified(); } }
protected void computeBbox() { if (bbox == null) return; if (bbox.getVertices() == null || bbox.getVertices().length != 8) { bbox.setVertices(new float[8]); } float dx = getAlignDx(getWidth(), orgAlign); float dy = getAlignDy(getHeight(), orgAlign); float[] verts = bbox.getVertices(); verts[0] = dx; verts[1] = dy; verts[2] = dx; verts[3] = getHeight() + dy; verts[4] = getWidth() + dx; verts[5] = getHeight() + dy; verts[6] = getWidth() + dx; verts[7] = dy; bbox.dirty(); }
private void computeBbox() { if (bbox == null) return; if (bbox.getVertices() == null || bbox.getVertices().length != 8) { bbox.setVertices(new float[8]); } float dx = getAlignDx(getWidth(), orgAlign); float dy = getAlignDy(getHeight(), orgAlign); float[] verts = bbox.getVertices(); verts[0] = dx; verts[1] = dy; verts[2] = dx; verts[3] = getHeight() + dy; verts[4] = getWidth() + dx; verts[5] = getHeight() + dy; verts[6] = getWidth() + dx; verts[7] = dy; bbox.dirty(); }
@Override public void write(Json json) { BladeJson bjson = (BladeJson) json; if (bjson.getMode() == Mode.MODEL) { json.writeValue("id", id); json.writeValue("bbox", bbox.getVertices()); } else { } float worldScale = EngineAssetManager.getInstance().getScale(); Vector2 scaledPos = new Vector2(bbox.getX() / worldScale, bbox.getY() / worldScale); json.writeValue("pos", scaledPos); json.writeValue("visible", visible); }
bbox = new Polygon(new float[8]); if (bbox != null && (bbox.getVertices() == null || bbox.getVertices().length != 8)) { bbox.setVertices(new float[8]); float[] verts = bbox.getVertices(); float[] verts = bbox.getVertices(); verts[0] = minX; verts[1] = minY;
o.getPolygon().getVertices() );
if (p1.getVertices().length == 0 || p2.getVertices().length == 0) { return false; if (overlap.getVertices().length == floatArray2.size) System.arraycopy(floatArray2.items, 0, overlap.getVertices(), 0, floatArray2.size); else overlap.setVertices(floatArray2.toArray());
verts = intersectionPoly.getVertices(); if(verts.length > 0) { parts.add(snapToGrid(verts));
@Override public void write(Json json) { BladeJson bjson = (BladeJson) json; // Reset vertices if bboxFromRenderer to save always with 0.0 value if (bboxFromRenderer && bjson.getMode() == Mode.MODEL) { float[] verts = bbox.getVertices(); bbox.setVertices(new float[8]); super.write(json); bbox.setVertices(verts); } else { super.write(json); } if (bjson.getMode() == Mode.MODEL) { json.writeValue("renderer", renderer, null); } else { json.writeValue("renderer", renderer); json.writeValue("tweens", tweens, ArrayList.class, Tween.class); json.writeValue("playingSound", playingSound); } json.writeValue("scaleX", scaleX); json.writeValue("scaleY", scaleY); json.writeValue("rot", rot); if(tint != null) json.writeValue("tint", tint); json.writeValue("fakeDepth", fakeDepth); json.writeValue("bboxFromRenderer", bboxFromRenderer); }
Polygon poly = selActor.getBBox(); float verts[] = poly.getVertices(); verts[vertIndex] += d.x; verts[vertIndex + 1] += d.y;