OLD | NEW |
| (Empty) |
1 part of dart.math; | |
2 class Point<T extends num> {final T x; | |
3 final T y; | |
4 const Point(T x, T y) : this.x = x, this.y = y; | |
5 String toString() => 'Point($x, $y)'; | |
6 bool operator ==(other) { | |
7 if (other is! Point) return false; | |
8 return x == other.x && y == other.y; | |
9 } | |
10 int get hashCode => _JenkinsSmiHash.hash2(x.hashCode, y.hashCode); | |
11 Point<T> operator +(Point<T> other) { | |
12 return new Point<T>(((__x0) => DEVC$RT.cast(__x0, num, T, "CompositeCast", """
line 37, column 25 of dart:math/point.dart: """, __x0 is T, false))(x + other.x)
, ((__x1) => DEVC$RT.cast(__x1, num, T, "CompositeCast", """line 37, column 38 o
f dart:math/point.dart: """, __x1 is T, false))(y + other.y)); | |
13 } | |
14 Point<T> operator -(Point<T> other) { | |
15 return new Point<T>(((__x2) => DEVC$RT.cast(__x2, num, T, "CompositeCast", """
line 46, column 25 of dart:math/point.dart: """, __x2 is T, false))(x - other.x)
, ((__x3) => DEVC$RT.cast(__x3, num, T, "CompositeCast", """line 46, column 38 o
f dart:math/point.dart: """, __x3 is T, false))(y - other.y)); | |
16 } | |
17 Point<T> operator *(num factor) { | |
18 return new Point<T>(((__x4) => DEVC$RT.cast(__x4, num, T, "CompositeCast", """
line 59, column 25 of dart:math/point.dart: """, __x4 is T, false))(x * factor),
((__x5) => DEVC$RT.cast(__x5, num, T, "CompositeCast", """line 59, column 37 of
dart:math/point.dart: """, __x5 is T, false))(y * factor)); | |
19 } | |
20 double get magnitude => sqrt(x * x + y * y); | |
21 double distanceTo(Point<T> other) { | |
22 var dx = x - other.x; | |
23 var dy = y - other.y; | |
24 return sqrt(dx * dx + dy * dy); | |
25 } | |
26 T squaredDistanceTo(Point<T> other) { | |
27 var dx = x - other.x; | |
28 var dy = y - other.y; | |
29 return ((__x6) => DEVC$RT.cast(__x6, num, T, "CompositeCast", """line 86, col
umn 12 of dart:math/point.dart: """, __x6 is T, false))(dx * dx + dy * dy); | |
30 } | |
31 } | |
OLD | NEW |