OLD | NEW |
1 var math; | 1 var math; |
2 (function(exports) { | 2 (function(exports) { |
3 'use strict'; | 3 'use strict'; |
4 class _JenkinsSmiHash extends core.Object { | 4 class _JenkinsSmiHash extends core.Object { |
5 static combine(hash, value) { | 5 static combine(hash, value) { |
6 hash = 536870911 & dart.notNull(hash) + dart.notNull(value); | 6 hash = 536870911 & dart.notNull(hash) + dart.notNull(value); |
7 hash = 536870911 & dart.notNull(hash) + ((524287 & dart.notNull(hash)) <<
10); | 7 hash = 536870911 & dart.notNull(hash) + ((524287 & dart.notNull(hash)) <<
10); |
8 return dart.notNull(hash) ^ dart.notNull(hash) >> 6; | 8 return dart.notNull(hash) ^ dart.notNull(hash) >> 6; |
9 } | 9 } |
10 static finish(hash) { | 10 static finish(hash) { |
(...skipping 19 matching lines...) Expand all Loading... |
30 } | 30 } |
31 ['=='](other) { | 31 ['=='](other) { |
32 if (!dart.is(other, Point)) | 32 if (!dart.is(other, Point)) |
33 return false; | 33 return false; |
34 return dart.notNull(dart.equals(this.x, dart.dload(other, 'x'))) && dart
.notNull(dart.equals(this.y, dart.dload(other, 'y'))); | 34 return dart.notNull(dart.equals(this.x, dart.dload(other, 'x'))) && dart
.notNull(dart.equals(this.y, dart.dload(other, 'y'))); |
35 } | 35 } |
36 get hashCode() { | 36 get hashCode() { |
37 return _JenkinsSmiHash.hash2(dart.hashCode(this.x), dart.hashCode(this.y
)); | 37 return _JenkinsSmiHash.hash2(dart.hashCode(this.x), dart.hashCode(this.y
)); |
38 } | 38 } |
39 ['+'](other) { | 39 ['+'](other) { |
| 40 dart.as(other, Point$(T)); |
40 return new (Point$(T))(dart.as(this.x['+'](other.x), T), dart.as(this.y[
'+'](other.y), T)); | 41 return new (Point$(T))(dart.as(this.x['+'](other.x), T), dart.as(this.y[
'+'](other.y), T)); |
41 } | 42 } |
42 ['-'](other) { | 43 ['-'](other) { |
| 44 dart.as(other, Point$(T)); |
43 return new (Point$(T))(dart.as(this.x['-'](other.x), T), dart.as(this.y[
'-'](other.y), T)); | 45 return new (Point$(T))(dart.as(this.x['-'](other.x), T), dart.as(this.y[
'-'](other.y), T)); |
44 } | 46 } |
45 ['*'](factor) { | 47 ['*'](factor) { |
46 return new (Point$(T))(dart.as(this.x['*'](factor), T), dart.as(this.y['
*'](factor), T)); | 48 return new (Point$(T))(dart.as(this.x['*'](factor), T), dart.as(this.y['
*'](factor), T)); |
47 } | 49 } |
48 get magnitude() { | 50 get magnitude() { |
49 return sqrt(dart.notNull(this.x['*'](this.x)) + dart.notNull(this.y['*']
(this.y))); | 51 return sqrt(dart.notNull(this.x['*'](this.x)) + dart.notNull(this.y['*']
(this.y))); |
50 } | 52 } |
51 distanceTo(other) { | 53 distanceTo(other) { |
| 54 dart.as(other, Point$(T)); |
52 let dx = this.x['-'](other.x); | 55 let dx = this.x['-'](other.x); |
53 let dy = this.y['-'](other.y); | 56 let dy = this.y['-'](other.y); |
54 return sqrt(dart.notNull(dx) * dart.notNull(dx) + dart.notNull(dy) * dar
t.notNull(dy)); | 57 return sqrt(dart.notNull(dx) * dart.notNull(dx) + dart.notNull(dy) * dar
t.notNull(dy)); |
55 } | 58 } |
56 squaredDistanceTo(other) { | 59 squaredDistanceTo(other) { |
| 60 dart.as(other, Point$(T)); |
57 let dx = this.x['-'](other.x); | 61 let dx = this.x['-'](other.x); |
58 let dy = this.y['-'](other.y); | 62 let dy = this.y['-'](other.y); |
59 return dart.as(dart.notNull(dx) * dart.notNull(dx) + dart.notNull(dy) *
dart.notNull(dy), T); | 63 return dart.as(dart.notNull(dx) * dart.notNull(dx) + dart.notNull(dy) *
dart.notNull(dy), T); |
60 } | 64 } |
61 } | 65 } |
62 return Point; | 66 return Point; |
63 }); | 67 }); |
64 let Point = Point$(); | 68 let Point = Point$(); |
65 class Random extends core.Object { | 69 class Random extends core.Object { |
66 Random(seed) { | 70 Random(seed) { |
(...skipping 17 matching lines...) Expand all Loading... |
84 } | 88 } |
85 ['=='](other) { | 89 ['=='](other) { |
86 if (!dart.is(other, Rectangle)) | 90 if (!dart.is(other, Rectangle)) |
87 return false; | 91 return false; |
88 return dart.notNull(dart.equals(this.left, dart.dload(other, 'left'))) &
& dart.notNull(dart.equals(this.top, dart.dload(other, 'top'))) && dart.notNull(
dart.equals(this.right, dart.dload(other, 'right'))) && dart.notNull(dart.equals
(this.bottom, dart.dload(other, 'bottom'))); | 92 return dart.notNull(dart.equals(this.left, dart.dload(other, 'left'))) &
& dart.notNull(dart.equals(this.top, dart.dload(other, 'top'))) && dart.notNull(
dart.equals(this.right, dart.dload(other, 'right'))) && dart.notNull(dart.equals
(this.bottom, dart.dload(other, 'bottom'))); |
89 } | 93 } |
90 get hashCode() { | 94 get hashCode() { |
91 return _JenkinsSmiHash.hash4(dart.hashCode(this.left), dart.hashCode(thi
s.top), dart.hashCode(this.right), dart.hashCode(this.bottom)); | 95 return _JenkinsSmiHash.hash4(dart.hashCode(this.left), dart.hashCode(thi
s.top), dart.hashCode(this.right), dart.hashCode(this.bottom)); |
92 } | 96 } |
93 intersection(other) { | 97 intersection(other) { |
| 98 dart.as(other, Rectangle$(T)); |
94 let x0 = max(this.left, other.left); | 99 let x0 = max(this.left, other.left); |
95 let x1 = min(this.left['+'](this.width), other.left['+'](other.width)); | 100 let x1 = min(this.left['+'](this.width), other.left['+'](other.width)); |
96 if (dart.notNull(x0) <= dart.notNull(x1)) { | 101 if (dart.notNull(x0) <= dart.notNull(x1)) { |
97 let y0 = max(this.top, other.top); | 102 let y0 = max(this.top, other.top); |
98 let y1 = min(this.top['+'](this.height), other.top['+'](other.height))
; | 103 let y1 = min(this.top['+'](this.height), other.top['+'](other.height))
; |
99 if (dart.notNull(y0) <= dart.notNull(y1)) { | 104 if (dart.notNull(y0) <= dart.notNull(y1)) { |
100 return new (Rectangle$(T))(dart.as(x0, T), dart.as(y0, T), dart.as(d
art.notNull(x1) - dart.notNull(x0), T), dart.as(dart.notNull(y1) - dart.notNull(
y0), T)); | 105 return new (Rectangle$(T))(dart.as(x0, T), dart.as(y0, T), dart.as(d
art.notNull(x1) - dart.notNull(x0), T), dart.as(dart.notNull(y1) - dart.notNull(
y0), T)); |
101 } | 106 } |
102 } | 107 } |
103 return null; | 108 return null; |
104 } | 109 } |
105 intersects(other) { | 110 intersects(other) { |
106 return dart.notNull(this.left['<='](dart.notNull(other.left) + dart.notN
ull(other.width))) && dart.notNull(other.left) <= dart.notNull(this.left['+'](th
is.width)) && dart.notNull(this.top['<='](dart.notNull(other.top) + dart.notNull
(other.height))) && dart.notNull(other.top) <= dart.notNull(this.top['+'](this.h
eight)); | 111 return dart.notNull(this.left['<='](dart.notNull(other.left) + dart.notN
ull(other.width))) && dart.notNull(other.left) <= dart.notNull(this.left['+'](th
is.width)) && dart.notNull(this.top['<='](dart.notNull(other.top) + dart.notNull
(other.height))) && dart.notNull(other.top) <= dart.notNull(this.top['+'](this.h
eight)); |
107 } | 112 } |
108 boundingBox(other) { | 113 boundingBox(other) { |
| 114 dart.as(other, Rectangle$(T)); |
109 let right = max(this.left['+'](this.width), other.left['+'](other.width)
); | 115 let right = max(this.left['+'](this.width), other.left['+'](other.width)
); |
110 let bottom = max(this.top['+'](this.height), other.top['+'](other.height
)); | 116 let bottom = max(this.top['+'](this.height), other.top['+'](other.height
)); |
111 let left = min(this.left, other.left); | 117 let left = min(this.left, other.left); |
112 let top = min(this.top, other.top); | 118 let top = min(this.top, other.top); |
113 return new (Rectangle$(T))(dart.as(left, T), dart.as(top, T), dart.as(da
rt.notNull(right) - dart.notNull(left), T), dart.as(dart.notNull(bottom) - dart.
notNull(top), T)); | 119 return new (Rectangle$(T))(dart.as(left, T), dart.as(top, T), dart.as(da
rt.notNull(right) - dart.notNull(left), T), dart.as(dart.notNull(bottom) - dart.
notNull(top), T)); |
114 } | 120 } |
115 containsRectangle(another) { | 121 containsRectangle(another) { |
116 return dart.notNull(this.left['<='](another.left)) && dart.notNull(this.
left['+'](this.width)) >= dart.notNull(another.left) + dart.notNull(another.widt
h) && dart.notNull(this.top['<='](another.top)) && dart.notNull(this.top['+'](th
is.height)) >= dart.notNull(another.top) + dart.notNull(another.height); | 122 return dart.notNull(this.left['<='](another.left)) && dart.notNull(this.
left['+'](this.width)) >= dart.notNull(another.left) + dart.notNull(another.widt
h) && dart.notNull(this.top['<='](another.top)) && dart.notNull(this.top['+'](th
is.height)) >= dart.notNull(another.top) + dart.notNull(another.height); |
117 } | 123 } |
118 containsPoint(another) { | 124 containsPoint(another) { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 let left = dart.as(min(a.x, b.x), T); | 176 let left = dart.as(min(a.x, b.x), T); |
171 let width = dart.as(core.num['-'](max(a.x, b.x), left), T); | 177 let width = dart.as(core.num['-'](max(a.x, b.x), left), T); |
172 let top = dart.as(min(a.y, b.y), T); | 178 let top = dart.as(min(a.y, b.y), T); |
173 let height = dart.as(core.num['-'](max(a.y, b.y), top), T); | 179 let height = dart.as(core.num['-'](max(a.y, b.y), top), T); |
174 return new (MutableRectangle$(T))(left, top, width, height); | 180 return new (MutableRectangle$(T))(left, top, width, height); |
175 } | 181 } |
176 get width() { | 182 get width() { |
177 return this[_width]; | 183 return this[_width]; |
178 } | 184 } |
179 set width(width) { | 185 set width(width) { |
| 186 dart.as(width, T); |
180 if (width['<'](0)) | 187 if (width['<'](0)) |
181 width = dart.as(_clampToZero(width), T); | 188 width = dart.as(_clampToZero(width), T); |
182 this[_width] = width; | 189 this[_width] = width; |
183 } | 190 } |
184 get height() { | 191 get height() { |
185 return this[_height]; | 192 return this[_height]; |
186 } | 193 } |
187 set height(height) { | 194 set height(height) { |
| 195 dart.as(height, T); |
188 if (height['<'](0)) | 196 if (height['<'](0)) |
189 height = dart.as(_clampToZero(height), T); | 197 height = dart.as(_clampToZero(height), T); |
190 this[_height] = height; | 198 this[_height] = height; |
191 } | 199 } |
192 } | 200 } |
193 MutableRectangle[dart.implements] = () => [Rectangle$(T)]; | 201 MutableRectangle[dart.implements] = () => [Rectangle$(T)]; |
194 dart.defineNamedConstructor(MutableRectangle, 'fromPoints'); | 202 dart.defineNamedConstructor(MutableRectangle, 'fromPoints'); |
195 return MutableRectangle; | 203 return MutableRectangle; |
196 }); | 204 }); |
197 let MutableRectangle = MutableRectangle$(); | 205 let MutableRectangle = MutableRectangle$(); |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 exports.sin = sin; | 454 exports.sin = sin; |
447 exports.cos = cos; | 455 exports.cos = cos; |
448 exports.tan = tan; | 456 exports.tan = tan; |
449 exports.acos = acos; | 457 exports.acos = acos; |
450 exports.asin = asin; | 458 exports.asin = asin; |
451 exports.atan = atan; | 459 exports.atan = atan; |
452 exports.sqrt = sqrt; | 460 exports.sqrt = sqrt; |
453 exports.exp = exp; | 461 exports.exp = exp; |
454 exports.log = log; | 462 exports.log = log; |
455 })(math || (math = {})); | 463 })(math || (math = {})); |
OLD | NEW |