content: package androidx.core.view.animation;
  
  import android.graphics.Path;
  import android.graphics.PathMeasure;
  import android.view.animation.Interpolator;
  
  class PathInterpolatorApi14 implements Interpolator {
      private static final float PRECISION = 0.002f;
      private final float[] mX;
      private final float[] mY;
  
      PathInterpolatorApi14(float controlX, float controlY) {
          this(createQuad(controlX, controlY));
      }
  
      PathInterpolatorApi14(float controlX1, float controlY1, float controlX2, float controlY2) {
          this(createCubic(controlX1, controlY1, controlX2, controlY2));
      }
  
      PathInterpolatorApi14(Path path) {
          PathMeasure pathMeasure = new PathMeasure(path, false);
          float length = pathMeasure.getLength();
          int i = ((int) (length / 0.002f)) + 1;
          this.mX = new float[i];
          this.mY = new float[i];
          float[] fArr = new float[2];
          for (int i2 = 0; i2 < i; i2++) {
              pathMeasure.getPosTan((((float) i2) * length) / ((float) (i - 1)), fArr, (float[]) null);
              this.mX[i2] = fArr[0];
              this.mY[i2] = fArr[1];
          }
      }
  
      private static Path createCubic(float controlX1, float controlY1, float controlX2, float controlY2) {
          Path path = new Path();
          path.moveTo(0.0f, 0.0f);
          path.cubicTo(controlX1, controlY1, controlX2, controlY2, 1.0f, 1.0f);
          return path;
      }
  
      private static Path createQuad(float controlX, float controlY) {
          Path path = new Path();
          path.moveTo(0.0f, 0.0f);
          path.quadTo(controlX, controlY, 1.0f, 1.0f);
          return path;
      }
  
      public float getInterpolation(float t) {
          if (t <= 0.0f) {
              return 0.0f;
          }
          if (t >= 1.0f) {
              return 1.0f;
          }
          int i = 0;
          int length = this.mX.length - 1;
          while (length - i > 1) {
              int i2 = (i + length) / 2;
              if (t < this.mX[i2]) {
                  length = i2;
              } else {
                  i = i2;
              }
          }
          float[] fArr = this.mX;
          float f = fArr[length];
          float f2 = fArr[i];
          float f3 = f - f2;
          if (f3 == 0.0f) {
              return this.mY[i];
          }
          float[] fArr2 = this.mY;
          float f4 = fArr2[i];
          return ((fArr2[length] - f4) * ((t - f2) / f3)) + f4;
      }
  }
  