Skip to content

Instantly share code, notes, and snippets.

@Scribbio
Created November 19, 2019 11:14
Show Gist options
  • Save Scribbio/284f408d191ea961c8bf50a45892e08a to your computer and use it in GitHub Desktop.
Save Scribbio/284f408d191ea961c8bf50a45892e08a to your computer and use it in GitHub Desktop.

Revisions

  1. Scribbio created this gist Nov 19, 2019.
    17 changes: 17 additions & 0 deletions PiFromX&Y
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    using System;

    class Pi {

    /// Approximate pi from xy coordinates.
    /// <returns>an approximation of pi</returns

    public static double Approx(Point x, Point y)
    {
    Point point = new Point();
    double r, per_cir;
    double PI = 3.14;
    double circleRadius = Math.Sqrt((point.x*point.x) + (point.y*point.y));
    per_cir = 2 * PI * circleRadius;
    return per_cir ;
    }
    }