mirror of
https://github.com/mangosfour/server.git
synced 2025-12-25 13:37:02 +00:00
[12632] Revert previous commit (see Notes)
This commit is contained in:
parent
1cd806c02e
commit
ef445ea523
1462 changed files with 9689 additions and 7080 deletions
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef G3D_MATRIX2_H
|
||||
#define G3D_MATRIX2_H
|
||||
#ifndef G3D_Matrix2_h
|
||||
#define G3D_Matrix2_h
|
||||
|
||||
#include "G3D/platform.h"
|
||||
#include "G3D/Vector2.h"
|
||||
|
|
@ -14,54 +14,59 @@ private:
|
|||
|
||||
public:
|
||||
|
||||
inline Matrix2() {
|
||||
Matrix2() {
|
||||
data[0][0] = 1.0f; data[0][1] = 0.0f;
|
||||
data[1][0] = 0.0f; data[1][1] = 1.0f;
|
||||
}
|
||||
|
||||
inline Matrix2(float v00, float v01, float v10, float v11) {
|
||||
Matrix2(float v00, float v01, float v10, float v11) {
|
||||
data[0][0] = v00; data[0][1] = v01;
|
||||
data[1][0] = v10; data[1][1] = v11;
|
||||
}
|
||||
|
||||
inline Vector2 operator*(const Vector2& v) const {
|
||||
static Matrix2 identity() {
|
||||
return Matrix2(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
Vector2 operator*(const Vector2& v) const {
|
||||
return Vector2(data[0][0] * v[0] + data[0][1] * v[1],
|
||||
data[1][0] * v[0] + data[1][1] * v[1]);
|
||||
}
|
||||
|
||||
inline Matrix2 inverse() const {
|
||||
return Matrix2(data[0][0], data[1][0],
|
||||
data[0][1], data[1][1]) * (1.0f / determinant());
|
||||
Matrix2 inverse() const {
|
||||
return Matrix2(data[1][1], -data[0][1],
|
||||
-data[1][0], data[0][0]) * (1.0f / determinant());
|
||||
}
|
||||
|
||||
inline Matrix2 transpose() const {
|
||||
Matrix2 transpose() const {
|
||||
return Matrix2(data[0][0], data[1][0],
|
||||
data[0][1], data[1][1]);
|
||||
}
|
||||
|
||||
inline float determinant() const {
|
||||
float determinant() const {
|
||||
return data[0][0] * data[1][1] - data[0][1] * data[1][0];
|
||||
}
|
||||
|
||||
inline Matrix2 operator*(float f) const {
|
||||
Matrix2 operator*(float f) const {
|
||||
return Matrix2(data[0][0] * f, data[0][1] * f,
|
||||
data[1][0] * f, data[1][1] * f);
|
||||
}
|
||||
|
||||
inline Matrix2 operator/(float f) const {
|
||||
Matrix2 operator/(float f) const {
|
||||
return Matrix2(data[0][0] / f, data[0][1] / f,
|
||||
data[1][0] / f, data[1][1] / f);
|
||||
}
|
||||
|
||||
inline float* operator[](int i) {
|
||||
float* operator[](int i) {
|
||||
debugAssert(i >= 0 && i <= 2);
|
||||
return data[i];
|
||||
}
|
||||
|
||||
inline const float* operator[](int i) const {
|
||||
const float* operator[](int i) const {
|
||||
debugAssert(i >= 0 && i <= 1);
|
||||
return data[i];
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue