Skip to content

Commit

Permalink
Merge pull request #130 from Scrabx3/dev
Browse files Browse the repository at this point in the history
NiMatrix3 plus & minus ops
  • Loading branch information
powerof3 authored Aug 24, 2024
2 parents 408aaf8 + 31f046b commit 20276e9
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/RE/N/NiMatrix3.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ namespace RE

bool operator==(const NiMatrix3& a_rhs) const;
bool operator!=(const NiMatrix3& a_rhs) const;
NiMatrix3 operator+(const NiMatrix3& a_rhs) const;
NiMatrix3 operator-(const NiMatrix3& a_rhs) const;
NiMatrix3 operator*(const NiMatrix3& a_rhs) const;
NiPoint3 operator*(const NiPoint3& a_point) const;
NiMatrix3 operator*(float a_scalar) const;
Expand Down
30 changes: 30 additions & 0 deletions src/RE/N/NiMatrix3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,4 +221,34 @@ namespace RE
return result;
}

NiMatrix3 NiMatrix3::operator+(const NiMatrix3& a_rhs) const
{
NiMatrix3 result;
result.entry[0][0] = entry[0][0] + a_rhs.entry[0][0];
result.entry[0][1] = entry[0][1] + a_rhs.entry[0][1];
result.entry[0][2] = entry[0][2] + a_rhs.entry[0][2];
result.entry[1][0] = entry[1][0] + a_rhs.entry[1][0];
result.entry[1][1] = entry[1][1] + a_rhs.entry[1][1];
result.entry[1][2] = entry[1][2] + a_rhs.entry[1][2];
result.entry[2][0] = entry[2][0] + a_rhs.entry[2][0];
result.entry[2][1] = entry[2][1] + a_rhs.entry[2][1];
result.entry[2][2] = entry[2][2] + a_rhs.entry[2][2];
return result;
}

NiMatrix3 NiMatrix3::operator-(const NiMatrix3& a_rhs) const
{
NiMatrix3 result;
result.entry[0][0] = entry[0][0] - a_rhs.entry[0][0];
result.entry[0][1] = entry[0][1] - a_rhs.entry[0][1];
result.entry[0][2] = entry[0][2] - a_rhs.entry[0][2];
result.entry[1][0] = entry[1][0] - a_rhs.entry[1][0];
result.entry[1][1] = entry[1][1] - a_rhs.entry[1][1];
result.entry[1][2] = entry[1][2] - a_rhs.entry[1][2];
result.entry[2][0] = entry[2][0] - a_rhs.entry[2][0];
result.entry[2][1] = entry[2][1] - a_rhs.entry[2][1];
result.entry[2][2] = entry[2][2] - a_rhs.entry[2][2];
return result;
}

}

0 comments on commit 20276e9

Please sign in to comment.