Hello, here is my little help function of the web but I have two problems.
1 / I have the impression that it does not turn degree by degree.
2 / how should I proceed to read the image I have in the program?
Code:
void rotation_image(){
int largeur = 720 / 2; //taille de limage et centre
int hauteur = 866 / 2; //taille de limage et centre
int x =0;
int y =0;
int x2 = 0;
int y2 = 0;
double anglevariable=0;
double sin2 = 0;
double cos2 = 0;
for(int i=0; i<360;i++){//faire une rotation de 360 degres
display.fillScreen(BLACK);
//Serial.println(i);
anglevariable=i;
sin2 = sin(-anglevariable);
cos2 = cos(-anglevariable);
for(int x = 0; x < 720; x++) {
for(int y = 0; y < 866; y++) {
x2 = x - largeur;
y2 = y - hauteur;
int nouveaux = (int)round((cos2 * x2 - sin2 * y2) + largeur);
int nouveauy = (int)round((sin2 * x2 + cos2 * y2) + hauteur);
if(nouveaux >= 0 && nouveaux < 720 && nouveauy >= 0 && nouveauy < 866) {
display.drawPixel(nouveaux,nouveauy,RED);
//display.writeRect(0, 0, 720, 866, (uint16_t*)ecran2); ???????
} else {
display.drawPixel(nouveaux,nouveauy,ORANGE);
}
}
}delay(1000);
}
}
or how to implement the function which is in pascal?
https://www.ocf.berkeley.edu/~fricke..._shearing.html