Sha256: da9d93630569d0c25461c1feb1a7fe6a51796826558044d1781785f7a4432793

Contents?: true

Size: 917 Bytes

Versions: 31

Compression:

Stored size: 917 Bytes

Contents

// Returns the arctangent of the quotient of its arguments.
// @param {Number} $y
// @param {Number} $x
// @example
//     atan2(0, 0)       // 0
//     atan2(0, -0.0)    // 3.14159
//     atan2(-0.0, 0)    // 0
//     atan2(-0.0, -0.0) // -3.14159
//     atan2(0, 1)       // 0
//     atan2(0, -1)      // 3.14159
@use "sass:math";

@function atan2 ($y, $x){
  @if $x > 0{
    @return atan(math.div($y, $x));
  }
  @else if $x < 0{
    @if $y < 0{
      @return atan(math.div($y, $x)) - $PI;
    }
    @else{
      @return atan(math.div($y, $x)) + $PI;
    }
  }
  @else{
    @if $y < 0{
      @return - $PI * .5;
    }
    @else if $y > 0{
      @return $PI * .5;
    }
    @else{
      @if math.div(1, $x) == math.div(1, 0){
        @return 0;
      }
      @else{
        @if math.div(1, $y) == math.div(1, 0){
          @return $PI;
        }
        @else{
          @return -$PI;
        }
      }
    }
  }
}

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
decidim-admin-0.27.9 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_atan2.scss
decidim-admin-0.27.8 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_atan2.scss
decidim-admin-0.27.7 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_atan2.scss
decidim-admin-0.27.6 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_atan2.scss
decidim-admin-0.26.10 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_atan2.scss
decidim-admin-0.26.9 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_atan2.scss
decidim-admin-0.27.5 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_atan2.scss
decidim-admin-0.26.8 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_atan2.scss
decidim-admin-0.27.4 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_atan2.scss
decidim-admin-0.27.3 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_atan2.scss
decidim-admin-0.26.7 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_atan2.scss
decidim-admin-0.26.5 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_atan2.scss
decidim-admin-0.27.2 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_atan2.scss
decidim-admin-0.27.1 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_atan2.scss
decidim-admin-0.26.4 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_atan2.scss
decidim-admin-0.27.0 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_atan2.scss
decidim-admin-0.26.3 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_atan2.scss
decidim-admin-0.27.0.rc2 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_atan2.scss
decidim-admin-0.27.0.rc1 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_atan2.scss
decidim-admin-0.26.2 app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_atan2.scss