public void arc()

in react-native-pytorch-core/android/src/main/java/org/pytorch/rn/core/canvas/CanvasRenderingContext2D.java [238:265]


  public void arc(
      float x, float y, float radius, float startAngle, float endAngle, boolean counterclockwise) {
    RectF rect =
        new RectF(
            PixelUtil.toPixelFromDIP(x - radius),
            PixelUtil.toPixelFromDIP(y - radius),
            PixelUtil.toPixelFromDIP(x + radius),
            PixelUtil.toPixelFromDIP(y + radius));

    float PI2 = (float) Math.PI * 2;

    float sweepAngle = endAngle - startAngle;
    float initialAngle = startAngle % PI2;

    if (!counterclockwise && sweepAngle < 0) {
      sweepAngle %= PI2;
      if (sweepAngle < 0 || initialAngle == 0) {
        sweepAngle += PI2;
      }
    } else if (counterclockwise && sweepAngle > 0) {
      sweepAngle %= PI2;
      if (sweepAngle > 0 || initialAngle == 0) {
        sweepAngle -= PI2;
      }
    }

    mPath.addArc(rect, radiansToDegrees(initialAngle), radiansToDegrees(sweepAngle));
  }