Skip to content

Commit bc29720

Browse files
committed
Renamed Mat2 to Matrix2x2
1 parent 6a2e51e commit bc29720

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

src/physac.h

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,13 @@ typedef enum PhysicsShapeType { PHYSICS_CIRCLE, PHYSICS_POLYGON } PhysicsShapeTy
129129
// Previously defined to be used in PhysicsShape struct as circular dependencies
130130
typedef struct PhysicsBodyData *PhysicsBody;
131131

132-
// Mat2 type (used for polygon shape rotation matrix)
133-
typedef struct Mat2 {
132+
// Matrix2x2 type (used for polygon shape rotation matrix)
133+
typedef struct Matrix2x2 {
134134
float m00;
135135
float m01;
136136
float m10;
137137
float m11;
138-
} Mat2;
138+
} Matrix2x2;
139139

140140
typedef struct PolygonData {
141141
unsigned int vertexCount; // Current used vertex and normals count
@@ -147,7 +147,7 @@ typedef struct PhysicsShape {
147147
PhysicsShapeType type; // Physics shape type (circle or polygon)
148148
PhysicsBody body; // Shape physics body reference
149149
float radius; // Circle shape radius (used for circle shapes)
150-
Mat2 transform; // Vertices transform matrix 2x2
150+
Matrix2x2 transform; // Vertices transform matrix 2x2
151151
PolygonData vertexData; // Polygon shape vertices position and normals data (just used for polygon shapes)
152152
} PhysicsShape;
153153

@@ -335,10 +335,10 @@ static Vector2 Vector2Add(Vector2 v1, Vector2 v2);
335335
static Vector2 Vector2Subtract(Vector2 v1, Vector2 v2); // Returns the subtract of two given vectors
336336
#endif
337337

338-
static Mat2 Mat2Radians(float radians); // Creates a matrix 2x2 from a given radians value
339-
static void Mat2Set(Mat2 *matrix, float radians); // Set values from radians to a created matrix 2x2
340-
static inline Mat2 Mat2Transpose(Mat2 matrix); // Returns the transpose of a given matrix 2x2
341-
static inline Vector2 Mat2MultiplyVector2(Mat2 matrix, Vector2 vector); // Multiplies a vector by a matrix 2x2
338+
static Matrix2x2 Mat2Radians(float radians); // Creates a matrix 2x2 from a given radians value
339+
static void Mat2Set(Matrix2x2 *matrix, float radians); // Set values from radians to a created matrix 2x2
340+
static inline Matrix2x2 Mat2Transpose(Matrix2x2 matrix); // Returns the transpose of a given matrix 2x2
341+
static inline Vector2 Mat2MultiplyVector2(Matrix2x2 matrix, Vector2 vector); // Multiplies a vector by a matrix 2x2
342342

343343
//----------------------------------------------------------------------------------
344344
// Module Functions Definition
@@ -605,7 +605,7 @@ PHYSACDEF void PhysicsShatter(PhysicsBody body, Vector2 position, float force)
605605
int count = vertexData.vertexCount;
606606
Vector2 bodyPos = body->position;
607607
Vector2 *vertices = (Vector2*)malloc(sizeof(Vector2) * count);
608-
Mat2 trans = body->shape.transform;
608+
Matrix2x2 trans = body->shape.transform;
609609
for (int i = 0; i < count; i++) vertices[i] = vertexData.positions[i];
610610

611611
// Destroy shattered physics body
@@ -1786,7 +1786,7 @@ static float FindAxisLeastPenetration(int *faceIndex, PhysicsShape shapeA, Physi
17861786
Vector2 transNormal = Mat2MultiplyVector2(shapeA.transform, normal);
17871787

17881788
// Transform face normal into B shape's model space
1789-
Mat2 buT = Mat2Transpose(shapeB.transform);
1789+
Matrix2x2 buT = Mat2Transpose(shapeB.transform);
17901790
normal = Mat2MultiplyVector2(buT, transNormal);
17911791

17921792
// Retrieve support point from B shape along -n
@@ -2014,16 +2014,16 @@ static inline Vector2 Vector2Subtract(Vector2 v1, Vector2 v2)
20142014
#endif
20152015

20162016
// Creates a matrix 2x2 from a given radians value
2017-
static Mat2 Mat2Radians(float radians)
2017+
static Matrix2x2 Mat2Radians(float radians)
20182018
{
20192019
float c = cosf(radians);
20202020
float s = sinf(radians);
20212021

2022-
return (Mat2){ c, -s, s, c };
2022+
return (Matrix2x2){ c, -s, s, c };
20232023
}
20242024

20252025
// Set values from radians to a created matrix 2x2
2026-
static void Mat2Set(Mat2 *matrix, float radians)
2026+
static void Mat2Set(Matrix2x2 *matrix, float radians)
20272027
{
20282028
float cos = cosf(radians);
20292029
float sin = sinf(radians);
@@ -2035,13 +2035,13 @@ static void Mat2Set(Mat2 *matrix, float radians)
20352035
}
20362036

20372037
// Returns the transpose of a given matrix 2x2
2038-
static inline Mat2 Mat2Transpose(Mat2 matrix)
2038+
static inline Matrix2x2 Mat2Transpose(Matrix2x2 matrix)
20392039
{
2040-
return (Mat2){ matrix.m00, matrix.m10, matrix.m01, matrix.m11 };
2040+
return (Matrix2x2){ matrix.m00, matrix.m10, matrix.m01, matrix.m11 };
20412041
}
20422042

20432043
// Multiplies a vector by a matrix 2x2
2044-
static inline Vector2 Mat2MultiplyVector2(Mat2 matrix, Vector2 vector)
2044+
static inline Vector2 Mat2MultiplyVector2(Matrix2x2 matrix, Vector2 vector)
20452045
{
20462046
return (Vector2){ matrix.m00*vector.x + matrix.m01*vector.y, matrix.m10*vector.x + matrix.m11*vector.y };
20472047
}

0 commit comments

Comments
 (0)