mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-13 07:03:25 +00:00
added some methods
This commit is contained in:
@@ -58,7 +58,7 @@ namespace uml
|
|||||||
{
|
{
|
||||||
return *reinterpret_cast<type*>(this);
|
return *reinterpret_cast<type*>(this);
|
||||||
}
|
}
|
||||||
[[nodiscard]] static Vector3 CreateVelocity(const Vector3& angles, const float length);
|
[[nodiscard]] static Vector3 CreateVelocity(const Vector3& angles, float length);
|
||||||
[[nodiscard]] float Sum() const;
|
[[nodiscard]] float Sum() const;
|
||||||
[[nodiscard]] float Sum2D() const;
|
[[nodiscard]] float Sum2D() const;
|
||||||
[[nodiscard]] Vector3 ViewAngleTo(const Vector3& other) const;
|
[[nodiscard]] Vector3 ViewAngleTo(const Vector3& other) const;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace uml
|
|||||||
|
|
||||||
matrix(const matrix &other);
|
matrix(const matrix &other);
|
||||||
|
|
||||||
matrix(size_t rows, size_t columns, float *pRaw);
|
matrix(size_t rows, size_t columns, const float *pRaw);
|
||||||
|
|
||||||
matrix(matrix &&other) noexcept;
|
matrix(matrix &&other) noexcept;
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ namespace uml
|
|||||||
float &at(size_t iRow, size_t iCol);
|
float &at(size_t iRow, size_t iCol);
|
||||||
|
|
||||||
float get_sum();
|
float get_sum();
|
||||||
|
void set_from_raw(const float* pRawMatrix);
|
||||||
matrix transpose();
|
matrix transpose();
|
||||||
|
|
||||||
void set(float val);
|
void set(float val);
|
||||||
@@ -56,7 +56,7 @@ namespace uml
|
|||||||
[[nodiscard]] float alg_complement(size_t i, size_t j) const;
|
[[nodiscard]] float alg_complement(size_t i, size_t j) const;
|
||||||
|
|
||||||
[[nodiscard]] float det() const;
|
[[nodiscard]] float det() const;
|
||||||
|
[[nodiscard]] const float* raw() const;
|
||||||
matrix &operator=(const matrix &other);
|
matrix &operator=(const matrix &other);
|
||||||
|
|
||||||
matrix &operator=(matrix &&other) noexcept;
|
matrix &operator=(matrix &&other) noexcept;
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace uml
|
|||||||
at(i, j) = other.at(i, j);
|
at(i, j) = other.at(i, j);
|
||||||
}
|
}
|
||||||
|
|
||||||
matrix::matrix(const size_t rows, const size_t columns, float *pRaw)
|
matrix::matrix(const size_t rows, const size_t columns, const float *pRaw)
|
||||||
{
|
{
|
||||||
m_rows = rows;
|
m_rows = rows;
|
||||||
m_columns = columns;
|
m_columns = columns;
|
||||||
@@ -285,4 +285,15 @@ namespace uml
|
|||||||
{screenWidth / 2.f, screenHeight / 2.f, 0.f, 1.f},
|
{screenWidth / 2.f, screenHeight / 2.f, 0.f, 1.f},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const float * matrix::raw() const
|
||||||
|
{
|
||||||
|
return m_pData.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
void matrix::set_from_raw(const float *pRawMatrix)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < m_columns*m_rows; ++i)
|
||||||
|
at(i / m_rows, i % m_columns) = pRawMatrix[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user