/** * After calling this method, the polygon has no vertex, area, or centroid, and is attached to a new reference frame. * @param referenceFrame {@code ReferenceFrame} reference frame to which this polygon will be attached. * Note that calling that method doesn't generate garbage. */ public void clear(ReferenceFrame referenceFrame) { convexPolygon.clear(); this.referenceFrame = referenceFrame; }
/** * After calling this method, the polygon has no vertex, area, or centroid and isUpToDate = true. * Use only when an empty is desired. * Note that calling that method doesn't generate garbage. */ public void clearAndUpdate() { clear(); isUpToDate = true; }
/** * After calling this method, the polygon has no vertex, area, or centroid. * Note that calling that method doesn't generate garbage. */ public void clear() { convexPolygon.clear(); }
public SimpleFootstep(RobotSide robotSide, FramePose soleFramePose) { this.robotSide = robotSide; this.soleFramePose.setIncludingFrame(soleFramePose); foothold.clear(); }
/** * Creates an empty convex polygon, adds N new vertices using an array of {@code Point2d}, updates the vertices so they are clockwise ordered, and initializes some essential numbers such as the centroid. * @param vertices {@code double[>=numberOfVertices][>=2]} the array of points that is used to creates the vertices. The each row contains one point whereas the (at least) two columns contains the coordinates x and y. * @param numberOfVertices {@code int} that is used to determine the number of vertices of the polygon. * Note the: {@code pointListArray.length} can be greater or equal to numberOfVertices. */ public ConvexPolygon2d(double[][] vertices, int numberOfVertices) { clear(); addVertices(vertices, numberOfVertices); update(); }
/** * This method does: * 1- {@code clear()}; * 2- {@code addVertices(vertices, numberOfVertices)}; * 3- {@code update()}. * @param vertices {@code Point2f[]} the list of points that is used to creates the vertices. * @param numberOfVertices {@code int} that is used to determine the number of vertices of the polygon. Note the: {@code vertices.length} can be greater or equal to numberOfVertices. */ public void setAndUpdate(Point2f[] vertices, int numberOfVertices) { clear(); addVertices(vertices, numberOfVertices); update(); }
/** * This method does: * 1- {@code clear()}; * 2- {@code addVertices(vertices, numberOfVertices)}; * 3- {@code update()}. * @param vertices {@code Point2d[]} the list of points that is used to creates the vertices. * @param numberOfVertices {@code int} that is used to determine the number of vertices of the polygon. Note the: {@code vertices.length} can be greater or equal to numberOfVertices. */ public void setAndUpdate(Point2d[] vertices, int numberOfVertices) { clear(); addVertices(vertices, numberOfVertices); update(); }
/** * This method does: * 1- {@code clear()}; * 2- {@code addVertices(vertices, numberOfVertices)}; * 3- {@code update()}. * @param vertices {@code double[>=numberOfVertices][>=2]} * @param numberOfVertices {@code int} */ public void setAndUpdate(double[][] vertices, int numberOfVertices) { clear(); addVertices(vertices, numberOfVertices); update(); }
/** * This method does: * 1- clear(); * 2- addVertices(otherPolygon); * 3- update(). * <p/> TODO There is no need to call update() there, instead update everything from the other polygon to make it faster.<p/> * @param otherPolygon {@code ConvexPolygon2d} */ public void setAndUpdate(ConvexPolygon2d otherPolygon) { clear(); addVertices(otherPolygon); update(); }
/** * This method does: * 1- {@code clear()}; * 2- {@code addVertices(vertices, numberOfVertices)}; * 3- {@code update()}. * @param vertices {@code List<Point2d>} the list of points that is used to creates the vertices. * @param numberOfVertices {@code int} that is used to determine the number of vertices of the polygon. Note the: {@code vertices.size()} can be greater or equal to numberOfVertices. */ public void setAndUpdate(List<Point2d> vertices, int numberOfVertices) { clear(); addVertices(vertices, numberOfVertices); update(); }
/** * This method does: * 1- {@code clear()}; * 2- {@code addVertices(firstPolygon)}; * 2- {@code addVertices(secondPolygon)}; * 3- {@code update()}. * <p/> TODO: Make this more efficient by finding the rotating calipers, as in the intersection method.<p/> * @param firstPolygon {@code ConvexPolygon2d} * @param secondPolygon {@code ConvexPolygon2d} */ public void setAndUpdate(ConvexPolygon2d firstPolygon, ConvexPolygon2d secondPolygon) { clear(); addVertices(firstPolygon); addVertices(secondPolygon); update(); }
private void updateConvexHull() { convexHull.clear(); for (int i = 0; i < this.getNumberOfConvexPolygons(); i++) { ConvexPolygon2d convexPolygon = this.getConvexPolygon(i); for (int j = 0; j < convexPolygon.getNumberOfVertices(); j++) convexHull.addVertex(convexPolygon.getVertex(j)); } convexHull.update(); }
public BasicFootstepMask(List<Point2d> footstepShape, double maskBufferSize) { this.safetyBuffer = maskBufferSize; footShapeWithBufferPolygon.clear(); for (Point2d vertex : footstepShape) { footShapeWithBufferPolygon.addVertex(inflate(vertex.getX()), inflate(vertex.getY())); } footShapeWithBufferPolygon.update(); }
public BasicFootstepMask(ContactablePlaneBody foot, double maskBufferSize) { this.safetyBuffer = maskBufferSize; footShapeWithBufferPolygon.clear(); for (FramePoint2d vertex : foot.getContactPoints2d()) { footShapeWithBufferPolygon.addVertex(inflate(vertex.getX()), inflate(vertex.getY())); } footShapeWithBufferPolygon.update(); }
/** * Efficiently combines two Disjoint Polygons. Returns false if not disjoint. * * @param polygon1 ConvexPolygon2d * @param polygon2 ConvexPolygon2d * @param combinedPolygonToPack ConvexPolygon2d polygon in which we put the convex hull containing polygon1 and polygon2. * @param connectingEdge1ToPack LineSegment2d first connecting edge between polygon1 and polygon2. * @param connectingEdge2Topack LineSegment2d second connecting edge between polygon1 and polygon2. * @return true if succeeded, false if failed */ public static boolean combineDisjointPolygons(ConvexPolygon2d polygon1, ConvexPolygon2d polygon2, ConvexPolygon2d combinedPolygonToPack, LineSegment2d connectingEdge1ToPack, LineSegment2d connectingEdge2Topack) { int[][] verticesIndices = new int[2][2]; boolean success = findConnectingEdgesVerticesIndexes(polygon1, polygon2, verticesIndices); if (!success) return false; combinedPolygonToPack.clear(); polygon1.addVerticesInClockwiseOrderInPolygon(verticesIndices[0][1], verticesIndices[0][0], combinedPolygonToPack); polygon2.addVerticesInClockwiseOrderInPolygon(verticesIndices[1][0], verticesIndices[1][1], combinedPolygonToPack); combinedPolygonToPack.update(); getConnectingEdges(polygon1, polygon2, connectingEdge1ToPack, connectingEdge2Topack, verticesIndices); return true; }
polygonToPack.clear(); for (Point3d point : projectedPoints)
intersectionPolygonToPack.clear();
partialFootholdPolygon.clear(); partialFootholdPolygon.addVertices(footstep.getPredictedContactPoints(), footstep.getPredictedContactPoints().size()); partialFootholdPolygon.update();