@Override public Point2d intersectionWith(LineSegment2d lineSegment) { return lineSegment.intersectionWith(this); }
@Override public FramePoint2d[] intersectionWith(FrameConvexPolygon2d convexPolygon) { checkReferenceFrameMatch(convexPolygon); Point2d[] intersection = this.lineSegment.intersectionWith(convexPolygon.convexPolygon); FramePoint2d[] ret = new FramePoint2d[intersection.length]; for (int i = 0; i < intersection.length; i++) { ret[i] = new FramePoint2d(convexPolygon.referenceFrame, intersection[i]); } return ret; }
@Override public FramePoint2d intersectionWith(FrameLine2d line) { checkReferenceFrameMatch(line); Point2d intersection = this.lineSegment.intersectionWith(line.line); if (intersection == null) { return null; } return new FramePoint2d(line.getReferenceFrame(), intersection); }
@Override public FramePoint2d intersectionWith(FrameLineSegment2d secondLineSegment) { checkReferenceFrameMatch(secondLineSegment); Point2d intersection = this.lineSegment.intersectionWith(secondLineSegment.lineSegment); if (intersection == null) { return null; } return new FramePoint2d(secondLineSegment.getReferenceFrame(), intersection); }
/** * Find the intersection point between this FrameLineSegment2d and the argument FrameLine2d and store it in the FramePoint2d argument. * @param intersectionPointToPack argument in which the intersect point is stored * @param line used to find the intersection with this line segment * @return true if successful, false otherwise. */ public boolean intersectionWith(FramePoint2d intersectionPointToPack, FrameLine2d line) { checkReferenceFrameMatch(line); Point2d intersection = this.lineSegment.intersectionWith(line.line); if (intersection == null) return false; intersectionPointToPack.setIncludingFrame(line.getReferenceFrame(), intersection); return true; }