newtonRaphsonIterate function
Implementation
double newtonRaphsonIterate(double aX, double aGuessT, double mX1, double mX2) {
  for (int i = 0; i < newtonIterations; ++i) {
    double currentSlope = getSlope(aGuessT, mX1, mX2);
    if (currentSlope == 0.0) {
      return aGuessT;
    }
    double currentX = calcBezier(aGuessT, mX1, mX2) - aX;
    // ignore: parameter_assignments
    aGuessT -= currentX / currentSlope;
  }
  return aGuessT;
}