Changeset 1284
- Timestamp:
- 12/06/23 03:25:43 (13 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/common/2d.h
r1274 r1284 39 39 T distanceTo(const XY &p) const { return sqrt(distanceToSq(p)); } 40 40 T distanceToSq(const XY &p) const { return double((p.x - x) * (p.x - x) + (p.y - y) * (p.y - y)); } 41 T magnitude() const { return sqrt(x * x + y * y); }42 41 T length() const { return sqrt(x * x + y * y); } 43 42 T lengthSq() const { return x * x + y * y; } … … 90 89 XYRect toInt() const { return XYRect(int(p.x), int(p.y), int(p.x + size.x) - int(p.x), int(p.y + size.y) - int(p.y)); } 91 90 bool operator==(const XYRect &r) const { return (p == r.p) && (size == r.size); } 91 bool operator!=(const XYRect &r) const { return !operator==(r); } 92 92 template <typename Q> const XYRect &operator=(const Q &other) { p = other.p; size = other.size; return *this; } 93 93
Note: See TracChangeset
for help on using the changeset viewer.