11.15
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user