/** this will check if the radius needs capping, and return a smaller value if it does */ private static final double getCappedOffset(final Point2D p0, final Point2D p2, final Point2D p4, final double offset) { final double radius = Math.min(p2.sub(p0).getLength(), p2.sub(p4).getLength()) / 2;// it must be half, as there may be another radius on the other side, and they should not cross over. return ((offset > radius) ? radius : offset); }
/** this will check if the radius needs capping, and return a smaller value if it does */ private static final double getCappedOffset(final Point2D p0, final Point2D p2, final Point2D p4, final double offset) { final double radius = Math.min(p2.sub(p0).getLength(), p2.sub(p4).getLength()) / 2;// it must be half, as there may be another radius on the other side, and they should not cross over. return ((offset > radius) ? radius : offset); }
/** this will check if the radius needs capping, and return a smaller value if it does */ private static final double getCappedOffset(final Point2D p0, final Point2D p2, final Point2D p4, final double offset) { final double radius = Math.min(p2.sub(p0).getLength(), p2.sub(p4).getLength()) / 2;// it must be half, as there may be another radius on the other side, and they should not cross over. return ((offset > radius) ? radius : offset); }
/** * Returns a new Point2D in the same direction as this Point2D * with a length of 1. * * @return Point2D */ public final Point2D unit() throws GeometryException { final double len = getLength(); if (len == 0) { throw new GeometryException("can't normalize (0,0)"); } return div(len); }
/** * Returns a new Point2D in the same direction as this Point2D * with a length of 1. * * @return Point2D */ public final Point2D unit() throws GeometryException { double len = getLength(); if (len == 0) { throw new GeometryException("can't normalize (0,0)"); } return div(len); }
/** * Returns a new Point2D in the same direction as this Point2D * with a length of 1. * * @return Point2D */ public final Point2D unit() throws GeometryException { final double len = getLength(); if (len == 0) { throw new GeometryException("can't normalize (0,0)"); } return div(len); }
/** * Returns a new Point2D in the same direction as this Point2D * with a length of 1. * * @return Point2D */ public final Point2D unit() throws GeometryException { final double len = getLength(); if (len == 0) { throw new GeometryException("can't normalize (0,0)"); } return div(len); }