void Particule::afficher(SDL_Renderer* rendu, int coucheAffichage, double tailleParticule) { SDL_Color c = getCouleur(); SDL_SetRenderDrawColor(rendu, c.r, c.g, c.b, c.a); SDL_Rect rect = {(int)(tailleParticule*(double)m_x), (int)(tailleParticule*(double)m_y),(int)tailleParticule,(int)tailleParticule}; SDL_RenderFillRect(rendu, &rect); }
FormeGeometrique* Polygone::rotation(double x, double y, double angle) { vector<Point> temp; for (auto point : listePoints) temp.push_back(point.rotation(x, y, angle)); return new Polygone(getCouleur(), temp); }
FormeGeometrique* Polygone::homothetie(double x, double y, double coeff) { vector<Point> temp; for (auto point : listePoints) temp.push_back(point.homothetie(x, y, coeff)); return new Polygone(getCouleur(), temp); }
FormeGeometrique* Polygone::translation(double l, double h) { vector<Point> temp; for (auto point : listePoints) temp.push_back(point.translation(l,h)); return new Polygone(getCouleur(), temp); }
double Polygone::calculAire() const { double aire = 0; for (size_t i = 2; i < listePoints.size(); i++) { aire += Triangle(getCouleur(), listePoints[0], listePoints[i - 1], listePoints[i]).calculAire(); } return aire; }
FormeGeometrique* Triangle::rotation(double x, double y, double angle) { return new Triangle(getCouleur(), base1.rotation(x,y,angle), base2.rotation(x,y,angle), sommet.rotation(x,y,angle)); }
FormeGeometrique* Triangle::homothetie(double x, double y, double coeff) { return new Triangle(getCouleur(), base1.homothetie(x, y, coeff), base2.homothetie(x, y, coeff), sommet.homothetie(x, y, coeff)); }
FormeGeometrique* Triangle::translation(double l, double h) { return new Triangle(getCouleur(), base1.translation(l,h), base2.translation(l,h), sommet.translation(l,h)); }