return nodes.get(0).getPoint();
}
if (index >= nodes.size()) {
return nodes.get(nodes.size() - 1).getPoint();
}
Node nodeFrom = nodes.get(index - 1);
Node nodeTo = nodes.get(index);
double dFrom = relativeShapeDistance[index - 1];
double dTo = relativeShapeDistance[index];
double ratio = (d - dFrom) / (dTo - dFrom);
double x = nodeFrom.getX() + ratio * (nodeTo.getX() - nodeFrom.getX());
double y = nodeFrom.getY() + ratio * (nodeTo.getY() - nodeFrom.getY());
return new Point2D.Double(x, y);
}