This commit is contained in:
2025-11-15 16:27:19 +08:00
parent 8db6f7b115
commit a0beb9eac7
35 changed files with 886 additions and 128 deletions
+39
View File
@@ -94,6 +94,45 @@ public:
template<typename U>
friend TMatrix3<U> operator * (U fScalar, const TMatrix3<U>& rkMatrix);
public:
static inline TMatrix3 makeTrans(T x, T y) {
return TMatrix3(
1, 0, x,
0, 1, y,
0, 0, 1);
}
static inline TMatrix3 makeTrans(const TVector2<T>& pos) {
return TMatrix3(
1, 0, pos.x,
0, 1, pos.y,
0, 0, 1);
}
static inline TMatrix3 makeScale(T x, T y) {
return TMatrix3(
x, 0, 0,
0, y, 0,
0, 0, 1);
}
static inline TMatrix3 makeScale(const TVector2<T>& scale) {
return TMatrix3(
scale.x, 0, 0,
0, scale.y, 0,
0, 0, 1);
}
//2D rotate, left multiplication
static inline TMatrix3 makeRotate(T angle) {
T s = sin(angle);
T c = cos(angle);
return TMatrix3(
c, -s, 0,
s, c, 0,
0, 0, 1);
}
public:
// Utilities