/** * Gets the reference frame of the first vertex or returns {@code null} if this supplier is * empty. */ @Override default ReferenceFrame getReferenceFrame() { return isEmpty() ? null : getVertex(0).getReferenceFrame(); }
/** * Tests on a per-vertex basis if this supplier and {@code other} are equal to an * {@code epsilon}. * * @param other the other supplier to compare against this. * @param epsilon the tolerance to use. * @return {@code true} if the two suppliers are equal. */ default boolean epsilonEquals(FrameVertex3DSupplier other, double epsilon) { if (getNumberOfVertices() != other.getNumberOfVertices()) return false; for (int i = 0; i < getNumberOfVertices(); i++) { if (!getVertex(i).epsilonEquals(other.getVertex(i), epsilon)) return false; } return true; }
/** * Adds the vertices from the given vertex supplier. * <p> * Note that this polygon is marked as being out-of-date. The method {@link #update()} has to be * called afterward before being able to perform operations with this polygon. * </p> * * @param frameVertex3DSupplier the supplier of vertices. * @see FrameVertex3DSupplier * @see #addVertexMatchingFrame(FramePoint3DReadOnly) */ default void addVerticesMatchingFrame(FrameVertex3DSupplier frameVertex3DSupplier) { for (int index = 0; index < frameVertex3DSupplier.getNumberOfVertices(); index++) { addVertexMatchingFrame(frameVertex3DSupplier.getVertex(index)); } }
/** * Tests on a per-vertex basis if this supplier and {@code other} are equal. * * @param other the other supplier to compare against this. * @return {@code true} if the two suppliers are equal. */ default boolean equals(FrameVertex3DSupplier other) { if (other == null) return false; if (getNumberOfVertices() != other.getNumberOfVertices()) return false; for (int i = 0; i < getNumberOfVertices(); i++) { if (!getVertex(i).equals(other.getVertex(i))) return false; } return true; }
/** * Adds the vertices from the given vertex supplier. * <p> * Note that this polygon is marked as being out-of-date. The method {@link #update()} has to be * called afterward before being able to perform operations with this polygon. * </p> * <p> * Only the x and y coordinates of each vertex is used to add a vertex to this polygon. * </p> * * @param frameVertex3DSupplier the supplier of vertices. * @throws ReferenceFrameMismatchException if any of the given {@code vertices} is a * {@code FramePoint3DReadOnly} and is not expressed in the same reference frame as * {@code this}. * @see FrameVertex3DSupplier * @see #addVertex(FramePoint3DReadOnly) */ default void addVertices(FrameVertex3DSupplier frameVertex3DSupplier) { for (int index = 0; index < frameVertex3DSupplier.getNumberOfVertices(); index++) { addVertex(frameVertex3DSupplier.getVertex(index)); } }
assertTrue(original.get(j) == supplier.getVertex(j)); assertTrue(subList.get(j) == supplier.getVertex(j)); assertTrue(subList.get(j) == supplier.getVertex(j)); assertTrue(original.get(j) == supplier.getVertex(j)); assertTrue(subList.get(j) == supplier.getVertex(j)); assertTrue(subList.get(j) == supplier.getVertex(j));