/** * Computes the coordinates of the possible intersection(s) between this line and the given convex * polygon 2D. * <p> * Edge cases: * <ul> * <li>If the polygon has no vertices, this method behaves as if there is no intersections. * <li>If no intersections exist, this method returns {@code 0} and the two intersection-to-pack * arguments remain unmodified. * <li>If there is only one intersection, this method returns {@code 1} and the coordinates of the * only intersection are stored in {@code firstIntersectionToPack}. {@code secondIntersectionToPack} * remains unmodified. * </ul> * </p> * * @param convexPolygon the convex polygon this line may intersect. Not modified. * @param firstIntersectionToPack point in which the coordinates of the first intersection. Can be * {@code null}. Modified. * @param secondIntersectionToPack point in which the coordinates of the second intersection. Can be * {@code null}. Modified. * @return the number of intersections between this line and the polygon. * @throws OutdatedPolygonException if the convex polygon is not up-to-date. */ default int intersectionWith(ConvexPolygon2DReadOnly convexPolygon, Point2DBasics firstIntersectionToPack, Point2DBasics secondIntersectionToPack) { return convexPolygon.intersectionWith(this, firstIntersectionToPack, secondIntersectionToPack); }
/** * Computes the coordinates of the possible intersection(s) between a given line segment 2D and * this convex polygon 2D. * * @param lineSegment2D the line segment that may intersect this polygon. Not modified. * @param firstIntersectionToPack point in which the coordinates of the first intersection * between the line and the convex polygon. Can be {@code null}. Modified. * @param secondIntersectionToPack point in which the coordinates of the second intersection * between the line and the convex polygon. Can be {@code null}. Modified. * @return the number of intersections between the line and the polygon. * @throws ReferenceFrameMismatchException if {@code secondIntersectionToPack} and {@code this} * are not expressed in the same reference frame. * @see #intersectionWith(LineSegment2DReadOnly, Point2DBasics, Point2DBasics) */ default int intersectionWith(LineSegment2DReadOnly lineSegment2D, Point2DBasics firstIntersectionToPack, FixedFramePoint2DBasics secondIntersectionToPack) { checkReferenceFrameMatch(secondIntersectionToPack); return ConvexPolygon2DReadOnly.super.intersectionWith(lineSegment2D, firstIntersectionToPack, secondIntersectionToPack); }
/** * Computes the coordinates of the possible intersection(s) between a given line segment 2D and * this convex polygon 2D. * * @param lineSegment2D the line segment that may intersect this polygon. Not modified. * @param firstIntersectionToPack point in which the coordinates of the first intersection * between the line and the convex polygon. Can be {@code null}. Modified. * @param secondIntersectionToPack point in which the coordinates of the second intersection * between the line and the convex polygon. Can be {@code null}. Modified. * @return the number of intersections between the line and the polygon. * @throws ReferenceFrameMismatchException if {@code lineSegment2D} and {@code this} are not * expressed in the same reference frame. * @see #intersectionWith(LineSegment2DReadOnly, Point2DBasics, Point2DBasics) */ default int intersectionWith(FrameLineSegment2DReadOnly lineSegment2D, Point2DBasics firstIntersectionToPack, Point2DBasics secondIntersectionToPack) { checkReferenceFrameMatch(lineSegment2D); return ConvexPolygon2DReadOnly.super.intersectionWith(lineSegment2D, firstIntersectionToPack, secondIntersectionToPack); }
/** * Computes the coordinates of the possible intersection(s) between a given line segment 2D and * this convex polygon 2D. * * @param lineSegment2D the line segment that may intersect this polygon. Not modified. * @param firstIntersectionToPack point in which the coordinates of the first intersection * between the line and the convex polygon. Can be {@code null}. Modified. * @param secondIntersectionToPack point in which the coordinates of the second intersection * between the line and the convex polygon. Can be {@code null}. Modified. * @return the number of intersections between the line and the polygon. * @throws ReferenceFrameMismatchException if {@code firstIntersectionToPack} and {@code this} * are not expressed in the same reference frame. * @see #intersectionWith(LineSegment2DReadOnly, Point2DBasics, Point2DBasics) */ default int intersectionWith(LineSegment2DReadOnly lineSegment2D, FixedFramePoint2DBasics firstIntersectionToPack, Point2DBasics secondIntersectionToPack) { checkReferenceFrameMatch(firstIntersectionToPack); return ConvexPolygon2DReadOnly.super.intersectionWith(lineSegment2D, firstIntersectionToPack, secondIntersectionToPack); }
/** * Computes the coordinates of the possible intersection(s) between a given line 2D and this * convex polygon 2D. * * @param line the line that may intersect this polygon. Not modified. * @param firstIntersectionToPack point in which the coordinates of the first intersection * between the line and the convex polygon. Can be {@code null}. Modified. * @param secondIntersectionToPack point in which the coordinates of the second intersection * between the line and the convex polygon. Can be {@code null}. Modified. * @return the number of intersections between the line and the polygon. * @throws ReferenceFrameMismatchException {@code firstIntersectionToPack} and {@code this} are * not expressed in the same reference frame. * @see #intersectionWith(Line2DReadOnly, Point2DBasics, Point2DBasics) */ default int intersectionWith(Line2DReadOnly line, FixedFramePoint2DBasics firstIntersectionToPack, Point2DBasics secondIntersectionToPack) { checkReferenceFrameMatch(firstIntersectionToPack); return ConvexPolygon2DReadOnly.super.intersectionWith(line, firstIntersectionToPack, secondIntersectionToPack); }
/** * Computes the coordinates of the possible intersection(s) between a given line 2D and this * convex polygon 2D. * * @param line the line that may intersect this polygon. Not modified. * @param firstIntersectionToPack point in which the coordinates of the first intersection * between the line and the convex polygon. Can be {@code null}. Modified. * @param secondIntersectionToPack point in which the coordinates of the second intersection * between the line and the convex polygon. Can be {@code null}. Modified. * @return the number of intersections between the line and the polygon. * @throws ReferenceFrameMismatchException if {@code code secondIntersectionToPack} and * {@code this} are not expressed in the same reference frame. * @see #intersectionWith(Line2DReadOnly, Point2DBasics, Point2DBasics) */ default int intersectionWith(Line2DReadOnly line, Point2DBasics firstIntersectionToPack, FixedFramePoint2DBasics secondIntersectionToPack) { checkReferenceFrameMatch(secondIntersectionToPack); return ConvexPolygon2DReadOnly.super.intersectionWith(line, firstIntersectionToPack, secondIntersectionToPack); }
/** * Computes the coordinates of the possible intersection(s) between a given line 2D and this * convex polygon 2D. * * @param line the line that may intersect this polygon. Not modified. * @param firstIntersectionToPack point in which the coordinates of the first intersection * between the line and the convex polygon. Can be {@code null}. Modified. * @param secondIntersectionToPack point in which the coordinates of the second intersection * between the line and the convex polygon. Can be {@code null}. Modified. * @return the number of intersections between the line and the polygon. * @throws ReferenceFrameMismatchException if {@code line} and {@code this} are not expressed in * the same reference frame. * @see #intersectionWith(Line2DReadOnly, Point2DBasics, Point2DBasics) */ default int intersectionWith(FrameLine2DReadOnly line, Point2DBasics firstIntersectionToPack, Point2DBasics secondIntersectionToPack) { checkReferenceFrameMatch(line); return ConvexPolygon2DReadOnly.super.intersectionWith(line, firstIntersectionToPack, secondIntersectionToPack); }
/** {@inheritDoc} */ @Override default FramePoint2DBasics[] intersectionWith(LineSegment2DReadOnly lineSegment2D) { Point2DBasics[] intersections = ConvexPolygon2DReadOnly.super.intersectionWith(lineSegment2D); if (intersections == null) { return null; } else { FramePoint2DBasics[] result = new FramePoint2DBasics[intersections.length]; for (int i = 0; i < intersections.length; i++) result[i] = new FramePoint2D(getReferenceFrame(), intersections[i]); return result; } }
/** {@inheritDoc} */ @Override default FramePoint2DBasics[] intersectionWith(Line2DReadOnly line) { Point2DBasics[] intersections = ConvexPolygon2DReadOnly.super.intersectionWith(line); if (intersections == null) { return null; } else { FramePoint2DBasics[] result = new FramePoint2DBasics[intersections.length]; for (int i = 0; i < intersections.length; i++) result[i] = new FramePoint2D(getReferenceFrame(), intersections[i]); return result; } }
/** {@inheritDoc} */ @Override default FramePoint2DBasics[] intersectionWith(ConvexPolygon2DReadOnly convexPolygon) { Point2DBasics[] intersections = convexPolygon.intersectionWith(this); if (intersections == null) { return null; } else { FramePoint2D[] frameIntersections = new FramePoint2D[intersections.length]; for (int i = 0; i < intersections.length; i++) frameIntersections[i] = new FramePoint2D(getReferenceFrame(), intersections[i]); return frameIntersections; } }
/** * Computes the coordinates of the possible intersection(s) between a given line 2D and this * convex polygon 2D. * * @param line the line that may intersect this polygon. Not modified. * @param firstIntersectionToPack point in which the coordinates of the first intersection * between the line and the convex polygon. Can be {@code null}. Modified. * @param secondIntersectionToPack point in which the coordinates of the second intersection * between the line and the convex polygon. Can be {@code null}. Modified. * @return the number of intersections between the line and the polygon. * @throws ReferenceFrameMismatchException if {@code line}, {@code firstIntersectionToPack}, and * {@code this} are not expressed in the same reference frame. * @see #intersectionWith(Line2DReadOnly, Point2DBasics, Point2DBasics) */ default int intersectionWith(FrameLine2DReadOnly line, FixedFramePoint2DBasics firstIntersectionToPack, Point2DBasics secondIntersectionToPack) { checkReferenceFrameMatch(line); checkReferenceFrameMatch(firstIntersectionToPack); return ConvexPolygon2DReadOnly.super.intersectionWith(line, firstIntersectionToPack, secondIntersectionToPack); }
/** * Computes the coordinates of the possible intersection(s) between a given line 2D and this * convex polygon 2D. * * @param line the line that may intersect this polygon. Not modified. * @param firstIntersectionToPack point in which the coordinates of the first intersection * between the line and the convex polygon. Can be {@code null}. Modified. * @param secondIntersectionToPack point in which the coordinates of the second intersection * between the line and the convex polygon. Can be {@code null}. Modified. * @return the number of intersections between the line and the polygon. * @throws ReferenceFrameMismatchException if {@code firstIntersectionToPack}, * {@code code secondIntersectionToPack}, and {@code this} are not expressed in the * same reference frame. * @see #intersectionWith(Line2DReadOnly, Point2DBasics, Point2DBasics) */ default int intersectionWith(Line2DReadOnly line, FixedFramePoint2DBasics firstIntersectionToPack, FixedFramePoint2DBasics secondIntersectionToPack) { checkReferenceFrameMatch(firstIntersectionToPack); checkReferenceFrameMatch(secondIntersectionToPack); return ConvexPolygon2DReadOnly.super.intersectionWith(line, firstIntersectionToPack, secondIntersectionToPack); }
/** * Computes the coordinates of the possible intersection(s) between a given line segment 2D and * this convex polygon 2D. * * @param lineSegment2D the line segment that may intersect this polygon. Not modified. * @param firstIntersectionToPack point in which the coordinates of the first intersection * between the line and the convex polygon. Can be {@code null}. Modified. * @param secondIntersectionToPack point in which the coordinates of the second intersection * between the line and the convex polygon. Can be {@code null}. Modified. * @return the number of intersections between the line and the polygon. * @throws ReferenceFrameMismatchException if {@code lineSegment2D}, * {@code secondIntersectionToPack}, and {@code this} are not expressed in the same * reference frame. * @see #intersectionWith(LineSegment2DReadOnly, Point2DBasics, Point2DBasics) */ default int intersectionWith(FrameLineSegment2DReadOnly lineSegment2D, Point2DBasics firstIntersectionToPack, FixedFramePoint2DBasics secondIntersectionToPack) { checkReferenceFrameMatch(lineSegment2D); checkReferenceFrameMatch(secondIntersectionToPack); return ConvexPolygon2DReadOnly.super.intersectionWith(lineSegment2D, firstIntersectionToPack, secondIntersectionToPack); }
/** * Computes the coordinates of the possible intersection(s) between a given line 2D and this * convex polygon 2D. * * @param line the line that may intersect this polygon. Not modified. * @param firstIntersectionToPack point in which the coordinates of the first intersection * between the line and the convex polygon. Can be {@code null}. Modified. * @param secondIntersectionToPack point in which the coordinates of the second intersection * between the line and the convex polygon. Can be {@code null}. Modified. * @return the number of intersections between the line and the polygon. * @throws ReferenceFrameMismatchException if {@code line}, * {@code code secondIntersectionToPack}, and {@code this} are not expressed in the * same reference frame. * @see #intersectionWith(Line2DReadOnly, Point2DBasics, Point2DBasics) */ default int intersectionWith(FrameLine2DReadOnly line, Point2DBasics firstIntersectionToPack, FixedFramePoint2DBasics secondIntersectionToPack) { checkReferenceFrameMatch(line); checkReferenceFrameMatch(secondIntersectionToPack); return ConvexPolygon2DReadOnly.super.intersectionWith(line, firstIntersectionToPack, secondIntersectionToPack); }
/** * Computes the coordinates of the possible intersection(s) between a given line segment 2D and * this convex polygon 2D. * * @param lineSegment2D the line segment that may intersect this polygon. Not modified. * @param firstIntersectionToPack point in which the coordinates of the first intersection * between the line and the convex polygon. Can be {@code null}. Modified. * @param secondIntersectionToPack point in which the coordinates of the second intersection * between the line and the convex polygon. Can be {@code null}. Modified. * @return the number of intersections between the line and the polygon. * @throws ReferenceFrameMismatchException if {@code lineSegment2D}, * {@code firstIntersectionToPack}, {@code secondIntersectionToPack}, and {@code this} * are not expressed in the same reference frame. * @see #intersectionWith(LineSegment2DReadOnly, Point2DBasics, Point2DBasics) */ default int intersectionWith(FrameLineSegment2DReadOnly lineSegment2D, FixedFramePoint2DBasics firstIntersectionToPack, FixedFramePoint2DBasics secondIntersectionToPack) { checkReferenceFrameMatch(lineSegment2D); checkReferenceFrameMatch(firstIntersectionToPack); checkReferenceFrameMatch(secondIntersectionToPack); return ConvexPolygon2DReadOnly.super.intersectionWith(lineSegment2D, firstIntersectionToPack, secondIntersectionToPack); }
/** * Computes the coordinates of the possible intersection(s) between a given line 2D and this * convex polygon 2D. * * @param line the line that may intersect this polygon. Not modified. * @param firstIntersectionToPack point in which the coordinates of the first intersection * between the line and the convex polygon. Can be {@code null}. Modified. * @param secondIntersectionToPack point in which the coordinates of the second intersection * between the line and the convex polygon. Can be {@code null}. Modified. * @return the number of intersections between the line and the polygon. * @throws ReferenceFrameMismatchException if {@code line}, {@code firstIntersectionToPack}, * {@code code secondIntersectionToPack}, and {@code this} are not expressed in the * same reference frame. * @see #intersectionWith(Line2DReadOnly, Point2DBasics, Point2DBasics) */ default int intersectionWith(FrameLine2DReadOnly line, FixedFramePoint2DBasics firstIntersectionToPack, FixedFramePoint2DBasics secondIntersectionToPack) { checkReferenceFrameMatch(line); checkReferenceFrameMatch(firstIntersectionToPack); checkReferenceFrameMatch(secondIntersectionToPack); return ConvexPolygon2DReadOnly.super.intersectionWith(line, firstIntersectionToPack, secondIntersectionToPack); }
/** * Computes the coordinates of the possible intersection(s) between a given line 2D and this * convex polygon 2D. * * @param line the line that may intersect this polygon. Not modified. * @param firstIntersectionToPack point in which the coordinates of the first intersection * between the line and the convex polygon. Can be {@code null}. Modified. * @param secondIntersectionToPack point in which the coordinates of the second intersection * between the line and the convex polygon. Can be {@code null}. Modified. * @return the number of intersections between the line and the polygon. * @see #intersectionWith(Line2DReadOnly, Point2DBasics, Point2DBasics) */ default int intersectionWith(Line2DReadOnly line, FramePoint2DBasics firstIntersectionToPack, FramePoint2DBasics secondIntersectionToPack) { firstIntersectionToPack.setReferenceFrame(getReferenceFrame()); secondIntersectionToPack.setReferenceFrame(getReferenceFrame()); return ConvexPolygon2DReadOnly.super.intersectionWith(line, firstIntersectionToPack, secondIntersectionToPack); }
/** * Computes the coordinates of the possible intersection(s) between a given line segment 2D and * this convex polygon 2D. * * @param lineSegment2D the line segment that may intersect this polygon. Not modified. * @param firstIntersectionToPack point in which the coordinates of the first intersection * between the line and the convex polygon. Can be {@code null}. Modified. * @param secondIntersectionToPack point in which the coordinates of the second intersection * between the line and the convex polygon. Can be {@code null}. Modified. * @return the number of intersections between the line and the polygon. * @see #intersectionWith(LineSegment2DReadOnly, Point2DBasics, Point2DBasics) */ default int intersectionWith(LineSegment2DReadOnly lineSegment2D, FramePoint2DBasics firstIntersectionToPack, FramePoint2DBasics secondIntersectionToPack) { firstIntersectionToPack.setReferenceFrame(getReferenceFrame()); secondIntersectionToPack.setReferenceFrame(getReferenceFrame()); return ConvexPolygon2DReadOnly.super.intersectionWith(lineSegment2D, firstIntersectionToPack, secondIntersectionToPack); }
/** * Computes the coordinates of the possible intersection(s) between a given line segment 2D and * this convex polygon 2D. * * @param lineSegment2D the line segment that may intersect this polygon. Not modified. * @param firstIntersectionToPack point in which the coordinates of the first intersection * between the line and the convex polygon. Can be {@code null}. Modified. * @param secondIntersectionToPack point in which the coordinates of the second intersection * between the line and the convex polygon. Can be {@code null}. Modified. * @return the number of intersections between the line and the polygon. * @throws ReferenceFrameMismatchException if {@code lineSegment2D} and {@code this} are not * expressed in the same reference frame. * @see #intersectionWith(LineSegment2DReadOnly, Point2DBasics, Point2DBasics) */ default int intersectionWith(FrameLineSegment2DReadOnly lineSegment2D, FramePoint2DBasics firstIntersectionToPack, FramePoint2DBasics secondIntersectionToPack) { checkReferenceFrameMatch(lineSegment2D); firstIntersectionToPack.setReferenceFrame(getReferenceFrame()); secondIntersectionToPack.setReferenceFrame(getReferenceFrame()); return ConvexPolygon2DReadOnly.super.intersectionWith(lineSegment2D, firstIntersectionToPack, secondIntersectionToPack); }
/** * Computes the coordinates of the possible intersection(s) between a given line 2D and this * convex polygon 2D. * * @param line the line that may intersect this polygon. Not modified. * @param firstIntersectionToPack point in which the coordinates of the first intersection * between the line and the convex polygon. Can be {@code null}. Modified. * @param secondIntersectionToPack point in which the coordinates of the second intersection * between the line and the convex polygon. Can be {@code null}. Modified. * @return the number of intersections between the line and the polygon. * @throws ReferenceFrameMismatchException if {@code line} and {@code this} are not expressed in * the same reference frame. * @see #intersectionWith(Line2DReadOnly, Point2DBasics, Point2DBasics) */ default int intersectionWith(FrameLine2DReadOnly line, FramePoint2DBasics firstIntersectionToPack, FramePoint2DBasics secondIntersectionToPack) { checkReferenceFrameMatch(line); firstIntersectionToPack.setReferenceFrame(getReferenceFrame()); secondIntersectionToPack.setReferenceFrame(getReferenceFrame()); return ConvexPolygon2DReadOnly.super.intersectionWith(line, firstIntersectionToPack, secondIntersectionToPack); }