public boolean areLinesPerpendicular(FrameLine2d line) { checkReferenceFrameMatch(line); return this.line.areLinesPerpendicular(line.getLine2d()); }
public static int cutPolygonWithLine(FrameLine2d cuttingLine, FrameConvexPolygon2d polygonToCut, RobotSide sideOfLineToCut) { cuttingLine.checkReferenceFrameMatch(polygonToCut); return cutPolygonWithLine(cuttingLine.getLine2d(), polygonToCut.getConvexPolygon2d(), sideOfLineToCut); }
public boolean getClosestPointWithRay(FramePoint2d closestVertexToPack, FrameLine2d ray) { ray.checkReferenceFrameMatch(referenceFrame); closestVertexToPack.setToZero(referenceFrame); boolean success = convexPolygon.getClosestPointWithRay(closestVertexToPack.getPoint(), ray.getLine2d()); return success; }
public void getIntersectionWithLine(FrameLine2d line, FramePoint2d intersectionToPack) { checkReferenceFrameMatch(line); checkReferenceFrameMatch(intersectionToPack); this.line.intersectionWith(line.getLine2d(), intersectionToPack.getPoint()); }
/** * There is actually no ray class at the moment, so we use a FrameLine2d. * * TODO: Make ray classes and use them. @dcalvert */ public void intersectWithRay(FrameConvexPolygon2d frameConvexPolygon2d, FrameLine2d frameRay2d) { checkAndSetFrames(frameConvexPolygon2d, frameRay2d); int intersectionTypeInt = ConvexPolygon2dCalculator.intersectionWithRay(frameRay2d.getLine2d(), intersectionPointOne.getPoint(), intersectionPointTwo.getPoint(), frameConvexPolygon2d.getConvexPolygon2d()); packIntersectionType(intersectionTypeInt); }
public void intersectWithLine(FrameConvexPolygon2d frameConvexPolygon2d, FrameLine2d frameLine2d) { checkAndSetFrames(frameConvexPolygon2d, frameLine2d); int intersectionTypeInt = ConvexPolygon2dCalculator.intersectionWithLine(frameLine2d.getLine2d(), intersectionPointOne.getPoint(), intersectionPointTwo.getPoint(), frameConvexPolygon2d.getConvexPolygon2d()); packIntersectionType(intersectionTypeInt); }
/** * Computes the intersections of a ray with this polygon. Since the polygon is convex the maximum * number of intersections is two. Returns the number of intersections found. If there are less * then two intersections the FramePoints are set to NaN. * * @param ray ray to intersect this polygon with * @param intersectionToPack1 modified - is set to the first intersection * If the are no intersections this will be set to NaN. * @param intersectionToPack2 modified - is set to the second intersection * If there is only one intersection this will be set to NaN. * @return The number of intersections 0, 1, or 2 */ public int intersectionWithRay(FrameLine2d ray, FramePoint2d intersectionToPack1, FramePoint2d intersectionToPack2) { checkReferenceFrameMatch(ray); intersectionToPack1.setToZero(referenceFrame); intersectionToPack2.setToZero(referenceFrame); return convexPolygon.intersectionWithRay(ray.getLine2d(), intersectionToPack1.getPoint(), intersectionToPack2.getPoint()); }
public void intersectionWith(FrameLine2d otherLine, Pair<FramePoint2d, FramePoint2d> intersection) { checkReferenceFrameMatch(otherLine); int numberOfIntersections = ConvexPolygon2dCalculator.intersectionWithLine(otherLine.getLine2d(), intersection.getFirst().getPoint(), intersection.getSecond().getPoint(), convexPolygon); if (numberOfIntersections < 2) { intersection.getSecond().setToNaN(); if (numberOfIntersections < 1) intersection.getFirst().setToNaN(); } }
public void setFrameLine2d(FrameLine2d frameLine2d) { if (frameLine2d == null) { pointX.set(Double.NaN); pointY.set(Double.NaN); vectorX.set(Double.NaN); vectorY.set(Double.NaN); return; } frameLine2d.checkReferenceFrameMatch(referenceFrame); Line2d line = frameLine2d.getLine2d(); pointX.set(line.getPoint().getX()); pointY.set(line.getPoint().getY()); vectorX.set(line.getNormalizedVector().getX()); vectorY.set(line.getNormalizedVector().getY()); }