Chromium Code Reviews| 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 * | |
| 9 * This rectangle uses a left-handed Cartesian coordinate system, with x | |
| 10 * directed to the right but y directed down, as per the convention in 2D | |
|
floitsch
2013/10/31 00:36:59
s/but/and/
| |
| 11 * computer graphics. | |
| 12 * | |
| 13 * See also: | |
| 14 * [W3C Coordinate Systems Specification](http://www.w3.org/TR/SVG/coords.htm l#InitialCoordinateSystem). | |
| 8 */ | 15 */ |
| 9 abstract class _RectangleBase<T extends num> { | 16 abstract class _RectangleBase<T extends num> { |
| 10 const _RectangleBase(); | 17 const _RectangleBase(); |
| 11 | 18 |
| 12 /** The x-coordinate of the left edge. */ | 19 /** The x-coordinate of the left edge. */ |
| 13 T get left; | 20 T get left; |
| 14 /** The y-coordinate of the top edge. */ | 21 /** The y-coordinate of the top edge. */ |
| 15 T get top; | 22 T get top; |
| 16 /** The `width` of the rectangle. */ | 23 /** The `width` of the rectangle. */ |
| 17 T get width; | 24 T get width; |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 148 MutableRectangle(this.left, this.top, this.width, this.height); | 155 MutableRectangle(this.left, this.top, this.width, this.height); |
| 149 | 156 |
| 150 factory MutableRectangle.fromPoints(Point<T> a, Point<T> b) { | 157 factory MutableRectangle.fromPoints(Point<T> a, Point<T> b) { |
| 151 T left = min(a.x, b.x); | 158 T left = min(a.x, b.x); |
| 152 T width = max(a.x, b.x) - left; | 159 T width = max(a.x, b.x) - left; |
| 153 T top = min(a.y, b.y); | 160 T top = min(a.y, b.y); |
| 154 T height = max(a.y, b.y) - top; | 161 T height = max(a.y, b.y) - top; |
| 155 return new MutableRectangle<T>(left, top, width, height); | 162 return new MutableRectangle<T>(left, top, width, height); |
| 156 } | 163 } |
| 157 } | 164 } |
| OLD | NEW |