Skip to content

Instantly share code, notes, and snippets.

@RezaAmd
Last active September 23, 2023 10:47
Show Gist options
  • Select an option

  • Save RezaAmd/f0299e9f59c1906819570170d4da99f0 to your computer and use it in GitHub Desktop.

Select an option

Save RezaAmd/f0299e9f59c1906819570170d4da99f0 to your computer and use it in GitHub Desktop.

Revisions

  1. RezaAmd revised this gist Sep 23, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion two_points-angle.js
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    // JavaScript:
    const angleCalculator = function(ax, ay, bx, by)
    {
    return Math.atan2(by-ay, bx-ax) * 180 / Math.PI
    return Math.atan2(by - ay, bx - ax) * 180 / Math.PI
    }
  2. RezaAmd renamed this gist Sep 23, 2023. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. RezaAmd revised this gist Sep 23, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion AngleCalculator.js
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    // JavaScript:
    const angleCalculator = function(ax, ay, bx, by)
    {
    return Math.atan((by-ay)/(bx-ax)) * 180 / Math.PI
    return Math.atan2(by-ay, bx-ax) * 180 / Math.PI
    }
  4. RezaAmd revised this gist Sep 23, 2023. No changes.
  5. RezaAmd revised this gist Sep 23, 2023. No changes.
  6. RezaAmd revised this gist Sep 23, 2023. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions AngleCalculator.js
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    // JavaScript:
    const angleCalculator = function(xa, ya, xb, yb)
    const angleCalculator = function(ax, ay, bx, by)
    {
    return Math.atan((yb-ya)/(xb-xa)) * 180 / Math.PI
    return Math.atan((by-ay)/(bx-ax)) * 180 / Math.PI
    }
  7. RezaAmd revised this gist Sep 23, 2023. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions AngleCalculator.js
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    // JavaScript:
    const angleCalculator = function(ax, ay, bx, by)
    const angleCalculator = function(xa, ya, xb, yb)
    {
    return Math.atan((by-ay)/(bx-ax)) * 180 / Math.PI
    return Math.atan((yb-ya)/(xb-xa)) * 180 / Math.PI
    }
  8. RezaAmd revised this gist Sep 23, 2023. No changes.
  9. RezaAmd revised this gist Sep 23, 2023. No changes.
  10. RezaAmd revised this gist Sep 23, 2023. No changes.
  11. RezaAmd revised this gist Sep 23, 2023. No changes.
  12. RezaAmd revised this gist Sep 23, 2023. No changes.
  13. RezaAmd revised this gist Sep 23, 2023. 1 changed file with 0 additions and 6 deletions.
    6 changes: 0 additions & 6 deletions AngleCalculator.js
    Original file line number Diff line number Diff line change
    @@ -2,10 +2,4 @@
    const angleCalculator = function(ax, ay, bx, by)
    {
    return Math.atan((by-ay)/(bx-ax)) * 180 / Math.PI
    }

    // C-Sharp:
    public double AngleCalculator(double ay, double ay, double bx, double by)
    {
    return Math.Atan((by-ay)/(bx-ax)) * 180 / Math.PI
    }
  14. RezaAmd revised this gist Sep 23, 2023. No changes.
  15. RezaAmd revised this gist Sep 23, 2023. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion AngleCalculator.js
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,11 @@
    // JavaScript:
    const angleCalculator = function(ax, ay, bx, by)
    {
    return Math.atan((by-ay)/(bx-ax)) * 180 / Math.PI;
    return Math.atan((by-ay)/(bx-ax)) * 180 / Math.PI
    }

    // C-Sharp:
    public double AngleCalculator(double ay, double ay, double bx, double by)
    {
    return Math.Atan((by-ay)/(bx-ax)) * 180 / Math.PI
    }
  16. RezaAmd revised this gist Sep 23, 2023. 2 changed files with 4 additions and 5 deletions.
    5 changes: 0 additions & 5 deletions AngleCalculator.cs
    Original file line number Diff line number Diff line change
    @@ -1,5 +0,0 @@
    // C-Sharp:
    public double CalculateAngle(double ax, double ay, double bx, double by)
    {
    return Math.Atan((by-ay)/(bx-ax)) * 180 / Math.PI;
    }
    4 changes: 4 additions & 0 deletions AngleCalculator.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    const angleCalculator = function(ax, ay, bx, by)
    {
    return Math.atan((by-ay)/(bx-ax)) * 180 / Math.PI;
    }
  17. RezaAmd created this gist Sep 23, 2023.
    5 changes: 5 additions & 0 deletions AngleCalculator.cs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    // C-Sharp:
    public double CalculateAngle(double ax, double ay, double bx, double by)
    {
    return Math.Atan((by-ay)/(bx-ax)) * 180 / Math.PI;
    }