code: static void lerp(Point2D start_, Point2D end_, double t, Point2D result) {
  		assert(start_ != result);
  		// When end == start, we want result to be equal to start, for all t
  		// values. At the same time, when end != start, we want the result to be
  		// equal to start for t==0 and end for t == 1.0
  		// The regular formula end_ * t + (1.0 - t) * start_, when end_ ==
  		// start_, and t at 1/3, produces value different from start
  		double rx, ry;
  		if (t <= 0.5) {
  			rx = start_.x + (end_.x - start_.x) * t;
  			ry = start_.y + (end_.y - start_.y) * t;
  		}
  		else {
  			rx = end_.x - (end_.x - start_.x) * (1.0 - t);
  			ry = end_.y - (end_.y - start_.y) * (1.0 - t);
  		}
  
  		assert (t < 0 || t > 1.0 || (rx >= start_.x && rx <= end_.x) || (rx <= start_.x && rx >= end_.x));
  		assert (t < 0 || t > 1.0 || (ry >= start_.y && ry <= end_.y) || (ry <= start_.y && ry >= end_.y));
  		result.x = rx;
  		result.y = ry;
  	}
docs: Computes interpolation between two values, using the interpolation factor t.
  The interpolation formula is (end - start) * t + start.
  However, the computation ensures that t = 0 produces exactly start, and t = 1, produces exactly end.
  It also guarantees that for 0 <= t <= 1, the interpolated value v is between start and end.