106 lines
3.1 KiB
C++
106 lines
3.1 KiB
C++
#include "cercle.h"
|
|
|
|
cercle :: cercle(point& pixel, int r):point(pixel),m_rayon(r)
|
|
{}
|
|
|
|
void cercle :: afficher(Bmp& imageTemp)
|
|
{
|
|
point pointCentre(getCoordX(),getCoordY(),getColor());
|
|
point pointTemp(m_rayon+getCoordX(),getCoordY(),VERT);
|
|
point pointSet(m_rayon+getCoordX(),getCoordY(),VERT);
|
|
for(float teta(0) ; teta<360 ; teta=teta+0.1)
|
|
{
|
|
pointSet.geoRotation(pointCentre,teta);
|
|
imageTemp.setpixel(getCoordX(),getCoordY(),getColor());
|
|
pointSet = pointTemp;
|
|
};
|
|
imageTemp.setpixel(pointTemp.getCoordX(),pointTemp.getCoordY(),NOIR);
|
|
}
|
|
|
|
void cercle :: afficherDecal(Bmp& imageTemp)
|
|
{
|
|
point pointCentre(getCoordX(),getCoordY(),getColor());
|
|
point pointSet(m_rayon+getCoordX(),getCoordY(),getColor());
|
|
for(float teta(0) ; teta<360 ; teta=teta+0.1)
|
|
{
|
|
pointSet.geoRotation(pointCentre,teta);
|
|
imageTemp.setpixel(pointSet.getCoordX(),pointSet.getCoordY(),pointSet.getColor());
|
|
};
|
|
}
|
|
|
|
void cercle :: afficherBeta(Bmp& imageTemp)
|
|
{
|
|
int x;
|
|
for(double y=(getCoordY()-m_rayon) ; y<(getCoordY()+m_rayon) ; y+=0.01)
|
|
{
|
|
x=sqrt((m_rayon*m_rayon)-(y-getCoordY())*(y-getCoordY()))+(getCoordX());
|
|
if(x>=0 && y>=0)
|
|
{
|
|
imageTemp.setpixel(x,y,getColor());
|
|
};
|
|
x=-sqrt((m_rayon*m_rayon)-(y-getCoordY())*(y-getCoordY()))+(getCoordX());
|
|
if(x>=0 && y>=0)
|
|
{
|
|
imageTemp.setpixel(x,y,getColor());
|
|
};
|
|
};
|
|
|
|
}
|
|
|
|
void cercle :: afficherPlein(Bmp& imageTemp)
|
|
{
|
|
point pointTemp,pointSet;
|
|
point pointCentre(getCoordX(),getCoordY(),getColor());
|
|
//ULONG couleurChangeante = VERT;
|
|
for(int rayonTemp(1) ; rayonTemp<m_rayon ; rayonTemp++)
|
|
{
|
|
pointTemp.redefine(rayonTemp+getCoordX(),getCoordY(),VERT);
|
|
pointSet.redefine(rayonTemp+getCoordX(),getCoordY(),VERT);
|
|
for(float teta(0) ; teta<360 ; teta=teta+0.1)
|
|
{
|
|
pointSet.geoRotation(pointCentre,teta);
|
|
imageTemp.setpixel(pointSet.getCoordX(),pointSet.getCoordY(),getColor());
|
|
//couleurChangeante++;
|
|
pointSet = pointTemp;
|
|
};
|
|
}
|
|
/*float maxTeta = exp(10/(rayonTemp));*/
|
|
}
|
|
|
|
/*void cercle :: geoTranslation(SHORT x)
|
|
{
|
|
point::geoTranslation(x);
|
|
}*/
|
|
|
|
/*void cercle :: geoTranslation(SHORT x,SHORT y)
|
|
{
|
|
point::geoTranslation(x,y);
|
|
}*/
|
|
|
|
void cercle :: geoHomothetie(point& centre, float k)
|
|
{
|
|
point::geoHomothetie(centre,k);
|
|
m_rayon=k*m_rayon;
|
|
}
|
|
|
|
/*void cercle :: geoRotation(point& centre, double degree)
|
|
{
|
|
point::geoRotation(centre,degree);
|
|
}*/
|
|
|
|
/*
|
|
int y(0),i(0);
|
|
string nomImage("img_"),extensionImage(".bmp"),finalImage;
|
|
y++;
|
|
if(y>2500)
|
|
{
|
|
string yString = to_string(i);
|
|
finalImage=nomImage+yString+extensionImage;
|
|
int n (finalImage.length());
|
|
char char_array[n + 1];
|
|
strcpy(char_array, finalImage.c_str());
|
|
imageTemp.write(char_array);
|
|
i++;
|
|
y=0;
|
|
}
|
|
*/
|