pointAlong method

Coordinate pointAlong(
  1. double segmentLengthFraction
)

Computes the {@link Coordinate} that lies a given fraction along the line defined by this segment. A fraction of 0.0 returns the start point of the segment; a fraction of 1.0 returns the end point of the segment. If the fraction is < 0.0 or > 1.0 the point returned will lie before the start or beyond the end of the segment.

@param segmentLengthFraction the fraction of the segment length along the line @return the point at that distance

Implementation

Coordinate pointAlong(double segmentLengthFraction) {
  Coordinate coord = new Coordinate.empty2D();
  coord.x = p0.x + segmentLengthFraction * (p1.x - p0.x);
  coord.y = p0.y + segmentLengthFraction * (p1.y - p0.y);
  return coord;
}