Skip to content

Commit

Permalink
implement negation of Vector
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Jensen committed Mar 1, 2024
1 parent 4412939 commit 882e30f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cdcMath/Math.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ Vector operator*(VectorArg a, float b) {
return {a.x * b, a.y * b, a.z * b, a.w * b};
}

Vector operator-(VectorArg a) {
return {-a.x, -a.y, -a.z, -a.w};
}

Matrix transpose(Matrix m) {
return {{
{m.m[0][0], m.m[1][0], m.m[2][0], m.m[3][0]},
Expand Down
1 change: 1 addition & 0 deletions cdcMath/Math.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@ extern Matrix identity4x4;
Vector& operator+=(Vector& a, VectorArg b);
Vector operator+(VectorArg a, VectorArg b);
Vector operator*(VectorArg a, float b);
Vector operator-(VectorArg a);

}

0 comments on commit 882e30f

Please sign in to comment.