[FIX] Fix some PVS Error

This commit is contained in:
NADAL Jean-Baptiste
2024-02-02 16:56:09 +01:00
parent bab4ba5a2b
commit 7d52592cd5
5 changed files with 18 additions and 5 deletions

View File

@@ -49,7 +49,7 @@ Canvas::Canvas(uint16_t a_width, uint16_t a_height) : m_width(a_width), m_height
{ {
for (int j = 0; j < m_height; ++j) for (int j = 0; j < m_height; ++j)
{ {
m_pixels[i][j] == Color(0, 0, 0); m_pixels[i][j] = Color(0, 0, 0);
} }
} }
} }
@@ -96,7 +96,7 @@ std::string Canvas::to_ppm(void)
for (int j = 0; j < m_height; j++) for (int j = 0; j < m_height; j++)
{ {
uint16_t the_col_number = 0; uint32_t the_col_number = 0;
for (int i = 0; i < m_width; i++) for (int i = 0; i < m_width; i++)
{ {
Color the_color; Color the_color;
@@ -115,7 +115,7 @@ std::string Canvas::to_ppm(void)
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
bool Canvas::add_color_component(std::string &a_str_value, uint16_t &a_col_number, uint8_t a_color) bool Canvas::add_color_component(std::string &a_str_value, uint32_t &a_col_number, uint8_t a_color)
{ {
std::string the_color_value; std::string the_color_value;

View File

@@ -54,7 +54,7 @@ namespace Raytracer
std::string to_ppm(void); std::string to_ppm(void);
private: private:
bool add_color_component(std::string &a_str_value, uint16_t &a_col_number, uint8_t a_color); bool add_color_component(std::string &a_str_value, uint32_t &a_col_number, uint8_t a_color);
private: private:
uint16_t m_width; uint16_t m_width;

View File

@@ -173,6 +173,17 @@ const Tuple Matrix::operator*(const Tuple &a_tuple) const
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
Matrix &Matrix::operator=(const Matrix &a_matrix)
{
m_rows = a_matrix.m_rows;
m_cols = a_matrix.m_cols;
m_data = a_matrix.m_data;
return *this;
}
/* ------------------------------------------------------------------------- */
bool Matrix::transpose(void) bool Matrix::transpose(void)
{ {
std::vector<std::vector<double>> the_copy = m_data; std::vector<std::vector<double>> the_copy = m_data;

View File

@@ -57,6 +57,8 @@ namespace Raytracer
const Matrix operator*(const Matrix &a_matrix) const; const Matrix operator*(const Matrix &a_matrix) const;
const Tuple operator*(const Tuple &a_tuple) const; const Tuple operator*(const Tuple &a_tuple) const;
Matrix &operator=(const Matrix &a_matrix);
bool transpose(void); bool transpose(void);
double determinant(void); double determinant(void);

View File

@@ -58,7 +58,7 @@ Tuple::Tuple(double a_x, double a_y, double a_z, double a_w) : m_x(a_x), m_y(a_y
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
Tuple::Tuple(std::vector<double> a_data) Tuple::Tuple(std::vector<double> a_data) : m_x(0.0), m_y(0.0), m_z(0.0), m_w(0.0)
{ {
int i = 0; int i = 0;
for (auto the_it1 = a_data.cbegin(); the_it1 != a_data.cend(); ++the_it1) for (auto the_it1 = a_data.cbegin(); the_it1 != a_data.cend(); ++the_it1)