public ConvexPolygon2d getConvexPolygon2d() { convexPolygon.checkIfUpToDate(); return convexPolygon; }
protected boolean hasExactlyOneVertex() { checkIfUpToDate(); return numberOfVertices == 1; }
protected boolean hasAtLeastThreeVertices() { checkIfUpToDate(); return numberOfVertices >= 3; }
protected boolean hasAtLeastOneVertex() { checkIfUpToDate(); return numberOfVertices >= 1; }
protected boolean hasExactlyTwoVertices() { checkIfUpToDate(); return numberOfVertices == 2; }
@Override public double distance(Line2d line) { checkIfUpToDate(); throw new RuntimeException("Not yet implemented"); }
@Override public double distance(ConvexPolygon2d convexPolygon) { checkIfUpToDate(); throw new RuntimeException("Not yet implemented"); } }
public boolean intersectionWith(ConvexPolygon2d convexPolygon, ConvexPolygon2d intersectionToPack) { checkIfUpToDate(); return ConvexPolygonTools.computeIntersectionOfPolygons(this, convexPolygon, intersectionToPack); }
public BoundingBox2d getBoundingBoxCopy() { checkIfUpToDate(); BoundingBox2d ret = new BoundingBox2d(boundingBox); return ret; }
/** Return the vertex from a clockwise ordered list */ public Point2d getVertex(int vertexIndex) { checkIfUpToDate(); return getVertexUnsafe(vertexIndex); }
public void getCentroid(Point2d centroid) { checkIfUpToDate(); centroid.set(this.centroid); }
public ConvexPolygon2d getConvexPolygon2dCopy() { convexPolygon.checkIfUpToDate(); return new ConvexPolygon2d(convexPolygon); }
protected void getPointsInClockwiseOrder(int startIndexInclusive, int endIndexInclusive, ArrayList<Point2d> pointList) { checkIfUpToDate(); int index = startIndexInclusive; while (true) { pointList.add(getVertex(index)); if (index == endIndexInclusive) break; index = getNextVertexIndex(index); } }
/** Return the vertex from a counter clockwise ordered list */ public Point2d getVertexCCW(int vertexIndex) { checkIfUpToDate(); checkNonEmpty(); checkIndexInBoundaries(vertexIndex); return clockwiseOrderedListOfPoints.get(numberOfVertices - 1 - vertexIndex); }
public Point2d getMaxXMinYPointCopy() { checkIfUpToDate(); return new Point2d(getVertex(maxXminY_index)); }
public Point2d getMaxXMaxYPointCopy() { checkIfUpToDate(); return new Point2d(getVertex(maxXmaxY_index)); }
@Override public ConvexPolygon2d intersectionWith(ConvexPolygon2d convexPolygon) { checkIfUpToDate(); ConvexPolygon2d ret = new ConvexPolygon2d(); boolean success = ConvexPolygonTools.computeIntersectionOfPolygons(this, convexPolygon, ret); if (!success) ret = null; return ret; }
public Point2d getMinXMaxYPointCopy() { checkIfUpToDate(); return new Point2d(getVertex(minXmaxY_index)); }
public Point2d getMinXMinYPointCopy() { checkIfUpToDate(); return new Point2d(getVertex(minXminY_index)); }
public void getFrameVertex(int vertexIndex, FrameTuple2d<?, ?> vertexToPack) { convexPolygon.checkIfUpToDate(); convexPolygon.checkNonEmpty(); convexPolygon.checkIndexInBoundaries(vertexIndex); vertexToPack.setIncludingFrame(referenceFrame, convexPolygon.getVertex(vertexIndex)); }