ShapeHelper { private static Point2D.Double getPointAt(double x1, double y1, double x2, double y2, double distance) { double length = Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)); return new Point2D.Double(x1 + distance * (x2 - x1) / length, y1 + distance * (y2 - y1) / length); } private  ShapeHelper(); static double getAreaPerimeterLength(Shape area); static double getLineLength(Shape line); static void printvertices(Shape shp); static List<Shape> splitLine(Shape line, double firstLineLength); static List<Shape> splitLineInSeg(Shape line, double segLength); static List<Shape> splitLine(Shape line, int nbPart); static Point2D.Double getPointAt(Shape shp, double distance); static List<Shape> perpendicularOffset(Shape shp, double offset); static Line2D.Double intersection(Line2D.Double line, Rectangle2D.Double bounds); static Geometry clipToExtent(Geometry theGeom, Envelope extent); static final double ONE_DEG_IN_RAD; }
@Test public void testGetPointAt() { Path2D.Double path = new Path2D.Double(); path.moveTo(10, 10); path.lineTo(20, 10); path.lineTo(20, 20); Double pointAt = ShapeHelper.getPointAt(path, 30); System.out.println ("PT: " + pointAt.getX() + ";" + pointAt.getY()); assertEquals(pointAt.getX(), 20.0, 0.00001); assertEquals(pointAt.getY(), 30.0, 0.00001); path = new Path2D.Double(); }