| OLD | NEW |
| 1 dart_library.library('dart/math', null, /* Imports */[ | 1 dart_library.library('dart/math', null, /* Imports */[ |
| 2 "dart/_runtime", | 2 "dart/_runtime", |
| 3 'dart/core' | 3 'dart/core' |
| 4 ], /* Lazy imports */[ | 4 ], /* Lazy imports */[ |
| 5 'dart/_js_helper' | 5 'dart/_js_helper' |
| 6 ], function(exports, dart, core, _js_helper) { | 6 ], function(exports, dart, core, _js_helper) { |
| 7 'use strict'; | 7 'use strict'; |
| 8 let dartx = dart.dartx; | 8 let dartx = dart.dartx; |
| 9 class _JenkinsSmiHash extends core.Object { | 9 class _JenkinsSmiHash extends core.Object { |
| 10 static combine(hash, value) { | 10 static combine(hash, value) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 const Point$ = dart.generic(function(T) { | 36 const Point$ = dart.generic(function(T) { |
| 37 class Point extends core.Object { | 37 class Point extends core.Object { |
| 38 Point(x, y) { | 38 Point(x, y) { |
| 39 this.x = x; | 39 this.x = x; |
| 40 this.y = y; | 40 this.y = y; |
| 41 } | 41 } |
| 42 toString() { | 42 toString() { |
| 43 return `Point(${this.x}, ${this.y})`; | 43 return `Point(${this.x}, ${this.y})`; |
| 44 } | 44 } |
| 45 ['=='](other) { | 45 ['=='](other) { |
| 46 if (!dart.is(other, Point$())) | 46 if (!dart.is(other, Point$())) return false; |
| 47 return false; | |
| 48 return dart.equals(this.x, dart.dload(other, 'x')) && dart.equals(this.y
, dart.dload(other, 'y')); | 47 return dart.equals(this.x, dart.dload(other, 'x')) && dart.equals(this.y
, dart.dload(other, 'y')); |
| 49 } | 48 } |
| 50 get hashCode() { | 49 get hashCode() { |
| 51 return _JenkinsSmiHash.hash2(dart.hashCode(this.x), dart.hashCode(this.y
)); | 50 return _JenkinsSmiHash.hash2(dart.hashCode(this.x), dart.hashCode(this.y
)); |
| 52 } | 51 } |
| 53 ['+'](other) { | 52 ['+'](other) { |
| 54 dart.as(other, Point$(T)); | 53 dart.as(other, Point$(T)); |
| 55 return new (Point$(T))(dart.notNull(this.x) + dart.notNull(other.x), dar
t.notNull(this.y) + dart.notNull(other.y)); | 54 return new (Point$(T))(dart.notNull(this.x) + dart.notNull(other.x), dar
t.notNull(this.y) + dart.notNull(other.y)); |
| 56 } | 55 } |
| 57 ['-'](other) { | 56 ['-'](other) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 85 '*': [Point$(T), [core.num]], | 84 '*': [Point$(T), [core.num]], |
| 86 distanceTo: [core.double, [Point$(T)]], | 85 distanceTo: [core.double, [Point$(T)]], |
| 87 squaredDistanceTo: [T, [Point$(T)]] | 86 squaredDistanceTo: [T, [Point$(T)]] |
| 88 }) | 87 }) |
| 89 }); | 88 }); |
| 90 return Point; | 89 return Point; |
| 91 }); | 90 }); |
| 92 let Point = Point$(); | 91 let Point = Point$(); |
| 93 class Random extends core.Object { | 92 class Random extends core.Object { |
| 94 static new(seed) { | 93 static new(seed) { |
| 95 if (seed === void 0) | 94 if (seed === void 0) seed = null; |
| 96 seed = null; | |
| 97 return seed == null ? dart.const(new _JSRandom()) : new _Random(seed); | 95 return seed == null ? dart.const(new _JSRandom()) : new _Random(seed); |
| 98 } | 96 } |
| 99 } | 97 } |
| 100 dart.setSignature(Random, { | 98 dart.setSignature(Random, { |
| 101 constructors: () => ({new: [Random, [], [core.int]]}) | 99 constructors: () => ({new: [Random, [], [core.int]]}) |
| 102 }); | 100 }); |
| 103 const _RectangleBase$ = dart.generic(function(T) { | 101 const _RectangleBase$ = dart.generic(function(T) { |
| 104 class _RectangleBase extends core.Object { | 102 class _RectangleBase extends core.Object { |
| 105 _RectangleBase() { | 103 _RectangleBase() { |
| 106 } | 104 } |
| 107 get right() { | 105 get right() { |
| 108 return dart.notNull(this.left) + dart.notNull(this.width); | 106 return dart.notNull(this.left) + dart.notNull(this.width); |
| 109 } | 107 } |
| 110 get bottom() { | 108 get bottom() { |
| 111 return dart.notNull(this.top) + dart.notNull(this.height); | 109 return dart.notNull(this.top) + dart.notNull(this.height); |
| 112 } | 110 } |
| 113 toString() { | 111 toString() { |
| 114 return `Rectangle (${this.left}, ${this.top}) ${this.width} x ${this.hei
ght}`; | 112 return `Rectangle (${this.left}, ${this.top}) ${this.width} x ${this.hei
ght}`; |
| 115 } | 113 } |
| 116 ['=='](other) { | 114 ['=='](other) { |
| 117 if (!dart.is(other, Rectangle)) | 115 if (!dart.is(other, Rectangle)) return false; |
| 118 return false; | |
| 119 return dart.equals(this.left, dart.dload(other, 'left')) && dart.equals(
this.top, dart.dload(other, 'top')) && dart.equals(this.right, dart.dload(other,
'right')) && dart.equals(this.bottom, dart.dload(other, 'bottom')); | 116 return dart.equals(this.left, dart.dload(other, 'left')) && dart.equals(
this.top, dart.dload(other, 'top')) && dart.equals(this.right, dart.dload(other,
'right')) && dart.equals(this.bottom, dart.dload(other, 'bottom')); |
| 120 } | 117 } |
| 121 get hashCode() { | 118 get hashCode() { |
| 122 return _JenkinsSmiHash.hash4(dart.hashCode(this.left), dart.hashCode(thi
s.top), dart.hashCode(this.right), dart.hashCode(this.bottom)); | 119 return _JenkinsSmiHash.hash4(dart.hashCode(this.left), dart.hashCode(thi
s.top), dart.hashCode(this.right), dart.hashCode(this.bottom)); |
| 123 } | 120 } |
| 124 intersection(other) { | 121 intersection(other) { |
| 125 dart.as(other, Rectangle$(T)); | 122 dart.as(other, Rectangle$(T)); |
| 126 let x0 = max(this.left, other.left); | 123 let x0 = max(this.left, other.left); |
| 127 let x1 = min(dart.notNull(this.left) + dart.notNull(this.width), dart.no
tNull(other.left) + dart.notNull(other.width)); | 124 let x1 = min(dart.notNull(this.left) + dart.notNull(this.width), dart.no
tNull(other.left) + dart.notNull(other.width)); |
| 128 if (dart.notNull(x0) <= dart.notNull(x1)) { | 125 if (dart.notNull(x0) <= dart.notNull(x1)) { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 let width = dart.notNull(max(a.x, b.x)) - dart.notNull(left); | 216 let width = dart.notNull(max(a.x, b.x)) - dart.notNull(left); |
| 220 let top = min(a.y, b.y); | 217 let top = min(a.y, b.y); |
| 221 let height = dart.notNull(max(a.y, b.y)) - dart.notNull(top); | 218 let height = dart.notNull(max(a.y, b.y)) - dart.notNull(top); |
| 222 return new (MutableRectangle$(T))(left, top, width, height); | 219 return new (MutableRectangle$(T))(left, top, width, height); |
| 223 } | 220 } |
| 224 get width() { | 221 get width() { |
| 225 return this[_width]; | 222 return this[_width]; |
| 226 } | 223 } |
| 227 set width(width) { | 224 set width(width) { |
| 228 dart.as(width, T); | 225 dart.as(width, T); |
| 229 if (dart.notNull(width) < 0) | 226 if (dart.notNull(width) < 0) width = _clampToZero(width); |
| 230 width = _clampToZero(width); | |
| 231 this[_width] = width; | 227 this[_width] = width; |
| 232 } | 228 } |
| 233 get height() { | 229 get height() { |
| 234 return this[_height]; | 230 return this[_height]; |
| 235 } | 231 } |
| 236 set height(height) { | 232 set height(height) { |
| 237 dart.as(height, T); | 233 dart.as(height, T); |
| 238 if (dart.notNull(height) < 0) | 234 if (dart.notNull(height) < 0) height = _clampToZero(height); |
| 239 height = _clampToZero(height); | |
| 240 this[_height] = height; | 235 this[_height] = height; |
| 241 } | 236 } |
| 242 } | 237 } |
| 243 MutableRectangle[dart.implements] = () => [Rectangle$(T)]; | 238 MutableRectangle[dart.implements] = () => [Rectangle$(T)]; |
| 244 dart.setSignature(MutableRectangle, { | 239 dart.setSignature(MutableRectangle, { |
| 245 constructors: () => ({ | 240 constructors: () => ({ |
| 246 MutableRectangle: [MutableRectangle$(T), [T, T, T, T]], | 241 MutableRectangle: [MutableRectangle$(T), [T, T, T, T]], |
| 247 fromPoints: [MutableRectangle$(T), [Point$(T), Point$(T)]] | 242 fromPoints: [MutableRectangle$(T), [Point$(T), Point$(T)]] |
| 248 }) | 243 }) |
| 249 }); | 244 }); |
| 250 return MutableRectangle; | 245 return MutableRectangle; |
| 251 }); | 246 }); |
| 252 let MutableRectangle = MutableRectangle$(); | 247 let MutableRectangle = MutableRectangle$(); |
| 253 function _clampToZero(value) { | 248 function _clampToZero(value) { |
| 254 dart.assert(dart.notNull(value) < 0); | 249 dart.assert(dart.notNull(value) < 0); |
| 255 return -dart.notNull(value) * 0; | 250 return -dart.notNull(value) * 0; |
| 256 } | 251 } |
| 257 dart.fn(_clampToZero, core.num, [core.num]); | 252 dart.fn(_clampToZero, core.num, [core.num]); |
| 258 const E = 2.718281828459045; | 253 const E = 2.718281828459045; |
| 259 const LN10 = 2.302585092994046; | 254 const LN10 = 2.302585092994046; |
| 260 const LN2 = 0.6931471805599453; | 255 const LN2 = 0.6931471805599453; |
| 261 const LOG2E = 1.4426950408889634; | 256 const LOG2E = 1.4426950408889634; |
| 262 const LOG10E = 0.4342944819032518; | 257 const LOG10E = 0.4342944819032518; |
| 263 const PI = 3.141592653589793; | 258 const PI = 3.141592653589793; |
| 264 const SQRT1_2 = 0.7071067811865476; | 259 const SQRT1_2 = 0.7071067811865476; |
| 265 const SQRT2 = 1.4142135623730951; | 260 const SQRT2 = 1.4142135623730951; |
| 266 function min(a, b) { | 261 function min(a, b) { |
| 267 if (!(typeof a == 'number')) | 262 if (!(typeof a == 'number')) dart.throw(new core.ArgumentError(a)); |
| 268 dart.throw(new core.ArgumentError(a)); | 263 if (!(typeof b == 'number')) dart.throw(new core.ArgumentError(b)); |
| 269 if (!(typeof b == 'number')) | 264 if (dart.notNull(a) > dart.notNull(b)) return b; |
| 270 dart.throw(new core.ArgumentError(b)); | 265 if (dart.notNull(a) < dart.notNull(b)) return a; |
| 271 if (dart.notNull(a) > dart.notNull(b)) | |
| 272 return b; | |
| 273 if (dart.notNull(a) < dart.notNull(b)) | |
| 274 return a; | |
| 275 if (typeof b == 'number') { | 266 if (typeof b == 'number') { |
| 276 if (typeof a == 'number') { | 267 if (typeof a == 'number') { |
| 277 if (a == 0.0) { | 268 if (a == 0.0) { |
| 278 return (dart.notNull(a) + dart.notNull(b)) * dart.notNull(a) * dart.no
tNull(b); | 269 return (dart.notNull(a) + dart.notNull(b)) * dart.notNull(a) * dart.no
tNull(b); |
| 279 } | 270 } |
| 280 } | 271 } |
| 281 if (a == 0 && dart.notNull(b[dartx.isNegative]) || dart.notNull(b[dartx.is
NaN])) | 272 if (a == 0 && dart.notNull(b[dartx.isNegative]) || dart.notNull(b[dartx.is
NaN])) return b; |
| 282 return b; | |
| 283 return a; | 273 return a; |
| 284 } | 274 } |
| 285 return a; | 275 return a; |
| 286 } | 276 } |
| 287 dart.fn(min, core.num, [core.num, core.num]); | 277 dart.fn(min, core.num, [core.num, core.num]); |
| 288 function max(a, b) { | 278 function max(a, b) { |
| 289 if (!(typeof a == 'number')) | 279 if (!(typeof a == 'number')) dart.throw(new core.ArgumentError(a)); |
| 290 dart.throw(new core.ArgumentError(a)); | 280 if (!(typeof b == 'number')) dart.throw(new core.ArgumentError(b)); |
| 291 if (!(typeof b == 'number')) | 281 if (dart.notNull(a) > dart.notNull(b)) return a; |
| 292 dart.throw(new core.ArgumentError(b)); | 282 if (dart.notNull(a) < dart.notNull(b)) return b; |
| 293 if (dart.notNull(a) > dart.notNull(b)) | |
| 294 return a; | |
| 295 if (dart.notNull(a) < dart.notNull(b)) | |
| 296 return b; | |
| 297 if (typeof b == 'number') { | 283 if (typeof b == 'number') { |
| 298 if (typeof a == 'number') { | 284 if (typeof a == 'number') { |
| 299 if (a == 0.0) { | 285 if (a == 0.0) { |
| 300 return dart.notNull(a) + dart.notNull(b); | 286 return dart.notNull(a) + dart.notNull(b); |
| 301 } | 287 } |
| 302 } | 288 } |
| 303 if (dart.notNull(b[dartx.isNaN])) | 289 if (dart.notNull(b[dartx.isNaN])) return b; |
| 304 return b; | |
| 305 return a; | 290 return a; |
| 306 } | 291 } |
| 307 if (b == 0 && dart.notNull(a[dartx.isNegative])) | 292 if (b == 0 && dart.notNull(a[dartx.isNegative])) return b; |
| 308 return b; | |
| 309 return a; | 293 return a; |
| 310 } | 294 } |
| 311 dart.fn(max, core.num, [core.num, core.num]); | 295 dart.fn(max, core.num, [core.num, core.num]); |
| 312 function atan2(a, b) { | 296 function atan2(a, b) { |
| 313 return Math.atan2(_js_helper.checkNum(a), _js_helper.checkNum(b)); | 297 return Math.atan2(_js_helper.checkNum(a), _js_helper.checkNum(b)); |
| 314 } | 298 } |
| 315 dart.fn(atan2, core.double, [core.num, core.num]); | 299 dart.fn(atan2, core.double, [core.num, core.num]); |
| 316 function pow(x, exponent) { | 300 function pow(x, exponent) { |
| 317 _js_helper.checkNum(x); | 301 _js_helper.checkNum(x); |
| 318 _js_helper.checkNum(exponent); | 302 _js_helper.checkNum(exponent); |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 exports.sin = sin; | 502 exports.sin = sin; |
| 519 exports.cos = cos; | 503 exports.cos = cos; |
| 520 exports.tan = tan; | 504 exports.tan = tan; |
| 521 exports.acos = acos; | 505 exports.acos = acos; |
| 522 exports.asin = asin; | 506 exports.asin = asin; |
| 523 exports.atan = atan; | 507 exports.atan = atan; |
| 524 exports.sqrt = sqrt; | 508 exports.sqrt = sqrt; |
| 525 exports.exp = exp; | 509 exports.exp = exp; |
| 526 exports.log = log; | 510 exports.log = log; |
| 527 }); | 511 }); |
| OLD | NEW |