OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 part of dart.math; | 4 part of dart.math; |
5 | 5 |
6 /** | 6 /** |
7 * A base class for representing two-dimensional axis-aligned rectangles. | 7 * A base class for representing two-dimensional axis-aligned rectangles. |
8 * | 8 * |
9 * This rectangle uses a left-handed Cartesian coordinate system, with x | 9 * This rectangle uses a left-handed Cartesian coordinate system, with x |
10 * directed to the right and y directed down, as per the convention in 2D | 10 * directed to the right and y directed down, as per the convention in 2D |
11 * computer graphics. | 11 * computer graphics. |
12 * | 12 * |
13 * See also: | 13 * See also: |
14 * [W3C Coordinate Systems Specification](http://www.w3.org/TR/SVG/coords.htm
l#InitialCoordinateSystem). | 14 * [W3C Coordinate Systems Specification](http://www.w3.org/TR/SVG/coords.htm
l#InitialCoordinateSystem). |
15 * | 15 * |
16 * The rectangle is the set of points with representable coordinates greater | 16 * The rectangle is the set of points with representable coordinates greater |
17 * than or equal to left/top, and with distance to left/top no greater than | 17 * than or equal to left/top, and with distance to left/top no greater than |
18 * width/height (to the limit of the precission of the coordinates). | 18 * width/height (to the limit of the precision of the coordinates). |
19 */ | 19 */ |
20 abstract class _RectangleBase<T extends num> { | 20 abstract class _RectangleBase<T extends num> { |
21 const _RectangleBase(); | 21 const _RectangleBase(); |
22 | 22 |
23 /** The x-coordinate of the left edge. */ | 23 /** The x-coordinate of the left edge. */ |
24 T get left; | 24 T get left; |
25 /** The y-coordinate of the top edge. */ | 25 /** The y-coordinate of the top edge. */ |
26 T get top; | 26 T get top; |
27 /** The width of the rectangle. */ | 27 /** The width of the rectangle. */ |
28 T get width; | 28 T get width; |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 | 267 |
268 /** | 268 /** |
269 * Converts a negative [int] or [double] to a zero-value of the same type. | 269 * Converts a negative [int] or [double] to a zero-value of the same type. |
270 * | 270 * |
271 * Returns `0` if value is int, `0.0` if value is double. | 271 * Returns `0` if value is int, `0.0` if value is double. |
272 */ | 272 */ |
273 T _clampToZero<T extends num>(T value) { | 273 T _clampToZero<T extends num>(T value) { |
274 assert(value < 0); | 274 assert(value < 0); |
275 return -value * 0; | 275 return -value * 0; |
276 } | 276 } |
OLD | NEW |