/** * Computes the orthogonal projection of a 2D point on this 2D line segment. * <p> * Edge cases: * <ul> * <li> if the length of this line segment is too small, * i.e. {@code lineSegmentStart.distanceSquared(lineSegmentEnd) < Epsilons.ONE_TRILLIONTH}, * this method fails and returns {@code false}. * <li> the projection can not be outside the line segment. * When the projection on the corresponding line is outside this line segment, the result is the closest of the two end points. * </ul> * </p> * * @param point2d the point to project on this line segment. Modified. */ @Override public void orthogonalProjection(Point2d point2d) { orthogonalProjection(point2d, point2d); }
/** * This is the same calculation as for {@link #orthogonalProjection(Point2d, Point2d)}: </br> * Computes the orthogonal projection of a 2D point on this 2D line segment. * <p> * Edge cases: * <ul> * <li> if the length of this line segment is too small, * i.e. {@code lineSegmentStart.distanceSquared(lineSegmentEnd) < Epsilons.ONE_TRILLIONTH}, * this method fails and returns {@code false}. * <li> the projection can not be outside the line segment. * When the projection on the corresponding line is outside this line segment, the result is the closest of the two end points. * </ul> * </p> * * @param point2d the point to compute the projection of. Not modified. * @param projectionToPack point in which the projection of the point onto this line segment is stored. Modified. * @return whether the method succeeded or not. */ public boolean getClosestPointOnLineSegment(Point2d closestPointToPack, Point2d point2d) { return orthogonalProjection(point2d, closestPointToPack); }
@Override public void orthogonalProjection(FramePoint2d point) { checkReferenceFrameMatch(point); lineSegment.orthogonalProjection(point.getPoint()); }
public void orthogonalProjection(FramePoint2d point, FramePoint2d projectedPointToPack) { checkReferenceFrameMatch(point); projectedPointToPack.setToZero(referenceFrame); lineSegment.orthogonalProjection(point.getPoint(), projectedPointToPack.getPoint()); }
private void solve(CoMHeightPartialDerivativesData coMHeightPartialDerivativesDataToPack, Point2d queryPoint, boolean isInDoubleSupport) projectionSegment.orthogonalProjection(queryPoint); double splineQuery = projectionSegment.percentageAlongLineSegment(queryPoint) * projectionSegment.length();