/** Same as getVertex(vertexIndex) but without checking if the polygon has been updated. Be careful when using it! */ protected Point2d getVertexUnsafe(int vertexIndex) { checkNonEmpty(); checkIndexInBoundaries(vertexIndex); return clockwiseOrderedListOfPoints.get(vertexIndex); }
public void removeVertex(int indexOfVertexToRemove) { checkNonEmpty(); checkIndexInBoundaries(indexOfVertexToRemove); if (indexOfVertexToRemove == numberOfVertices - 1) { numberOfVertices--; return; } isUpToDate = false; Collections.swap(clockwiseOrderedListOfPoints, indexOfVertexToRemove, numberOfVertices - 1); numberOfVertices--; }
/** 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 int getNextVertexIndex(int currentVertexIndex) { checkIfUpToDate(); checkIndexInBoundaries(currentVertexIndex); return getNextVertexIndexUnsafe(currentVertexIndex); }
public int getPreviousVertexIndex(int currentVertexIndex) { checkIfUpToDate(); checkIndexInBoundaries(currentVertexIndex); return getPreviousVertexIndexUnsafe(currentVertexIndex); }
public void getFrameVertex(int vertexIndex, FrameTuple2d<?, ?> vertexToPack) { convexPolygon.checkIfUpToDate(); convexPolygon.checkNonEmpty(); convexPolygon.checkIndexInBoundaries(vertexIndex); vertexToPack.setIncludingFrame(referenceFrame, convexPolygon.getVertex(vertexIndex)); }
public void getFrameVertexXY(int vertexIndex, FramePoint vertexToPack) { convexPolygon.checkIfUpToDate(); convexPolygon.checkNonEmpty(); convexPolygon.checkIndexInBoundaries(vertexIndex); vertexToPack.setXYIncludingFrame(referenceFrame, convexPolygon.getVertex(vertexIndex)); }