add IsElementOf + ColumnVector

This commit is contained in:
2024-03-03 12:16:26 +01:00
parent 9d3d78fe16
commit 3d01393f02
5 changed files with 96 additions and 7 deletions

View File

@@ -79,6 +79,9 @@ class Matrix {
*/
Matrix SubMatrix(std::size_t raw_origin, std::size_t column_origin, std::size_t raw, std::size_t column) const;
Matrix operator+(const Matrix& other) const;
Matrix operator-(const Matrix& other) const;
bool operator==(const Matrix& other) const;
/**
@@ -105,6 +108,16 @@ class Matrix {
* \param size La taille de la matrice carrée
*/
static Matrix Identity(std::size_t size);
/**
* \brief Construit une matrice colonne à partir de données existantes.\n
* Exemple :
* \code
* Matrix::ColumnVector({1, 2, 3, 4});
* \endcode
* construit une matrice de 4 lignes et 1 colonne de coordonnées (1, 2, 3, 4)
*/
static Matrix ColumnVector(std::initializer_list<Element>&&);
};
template <typename T>

View File

@@ -48,9 +48,15 @@ class Vect {
/**
* \brief Concatène la base actuelle avec un nouveau vecteur
* \param mat Une matrice colonne de taille GetDimension()
* \param vec Une matrice colonne de taille GetDimension()
*/
void AddVector(const Matrix& mat);
void AddVector(const Matrix& vec);
/**
* \brief Vérifie si le vecteur spécifié appartient au sous-espace vectoriel
* \param vec Une matrice colonne représentant le vecteur à tester
*/
bool IsElementOf(const Matrix& vec) const;
bool operator==(const Vect& other) const;
bool operator!=(const Vect& other) const;
@@ -90,4 +96,14 @@ class VectAffine {
const Matrix& GetOrigin() const {
return m_Origin;
}
/**
* \brief Vérifie si le vecteur spécifié appartient à l'espace affine
* \param vec Une matrice colonne représentant le vecteur à tester
*/
bool IsElementOf(const Matrix& vec) const;
bool operator==(const VectAffine& vect) const {
return m_Origin == vect.GetOrigin() && m_Base == vect.GetBase();
};
};