Changeset 1327 for cpp/common/2d.h
- Timestamp:
- 12/26/24 01:37:08 (6 days ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/common/2d.h
r1284 r1327 1 1 // This file is a part of Framsticks SDK. http://www.framsticks.com/ 2 // Copyright (C) 1999-202 3Maciej Komosinski and Szymon Ulatowski.2 // Copyright (C) 1999-2024 Maciej Komosinski and Szymon Ulatowski. 3 3 // See LICENSE.txt for details. 4 4 … … 46 46 static XY average(const XY &v1, const XY &v2) { return XY((v1.x + v2.x) * 0.5, (v1.y + v2.y) * 0.5); } 47 47 double getDirection() const { return atan2(y, x); } 48 float aspect() const { return float(x) / float(y); } 48 49 static XY interpolate(const XY &v1, const XY &v2, double t) { return universal_lerp(v1, v2, t); } 49 50 XY toInt() const { return XY(int(x), int(y)); } … … 68 69 void operator=(T x) { left = top = right = bottom = x; } 69 70 XYMargin operator-() const { return XYMargin(-left, -top, -right, -bottom); } 71 XYMargin operator+(const XYMargin<T> &m) const { return XYMargin(left + m.left, top + m.top, right + m.right, bottom + m.bottom); } 70 72 void operator=(const XYMargin<T> &other) { left = other.left; top = other.top; right = other.right; bottom = other.bottom; } 71 73 T horizontal() const { return left + right; } … … 184 186 return r; 185 187 } 186 188 187 189 XYRect intersection(const XYRect &r) const 188 190 {
Note: See TracChangeset
for help on using the changeset viewer.