1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
#include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;
const float Pi=3.1415;
class Point{
float x,y;
public:
Point(float x ,float y);
void affiche();
void deplace(float , float );
float abscisse();
float ordonnée();
void homotethie(float);
void rotation(float);
float rho(float,float);
float theta(float,float);
};
Point::Point(float ab,float ord){
x=ab;
y=ord;
}
void Point::rotation(float angle){
char *c[2];
x=cos(angle)*x-sin(angle)*y;
y=sin(angle)*x+cos(angle)*x;
float ang=theta(x,y);
float ray=rho(x,y);
printf("lescoordonnees polaires de p apres la rotation sont ");printf("%f et %f\n",ang,ray);
}
void Point::homotethie(float rap){
x=x*rap;
y=y*rap;
}
float Point::theta(float x,float y){
if (x!=0) { return atan(y/x);}
}
float Point::rho(float x,float y){
return sqrt (x*x+y*y);
}
float Point::ordonnée(){
return y;
}
float Point::abscisse(){
return x;
}
void Point::deplace(float dx,float dy){
x=x+dy;
y=y+dx;
}
void main(){
Point p(3,3);
cout<<"les coordonnees initiales sont "<<p.abscisse()<<" et "<<p.ordonnée()<<endl;
p.deplace(4,100);
cout<<"les coordonnees de p apres le deplacement sont "<<p.abscisse()<<" et "<<p.ordonnée()<<endl;
p.homotethie(4);
cout<<"les coordonnees de p apres l'homothetie sont "<<p.abscisse()<<" et "<<p.ordonnée()<<endl;
p.rotation(Pi/2);
} |
Partager