#include "Sphere.hpp"
#include <iostream>
using namespace std;
void Sphere::afficher(){
cout << "Center: ";
center.afficher() ;
cout << endl << "Radius: " << radius ;
cout << endl << "Matériau: " << materiau;
cout << endl;
Objet3D::afficher();
}
void Sphere::translater(Point3D tp, float tr){
float ix, iy, iz;
tp.lire(ix, iy, iz);
center.translater(ix,iy,iz);
radius += tr;
}
void Sphere::lire_radius(float& rd){
rd = radius;
}
void Sphere::donnerRayon(float& rd){
rd = radius;
}
void Sphere::donnerCenter(Point3D& cntr){
cntr = center;
}
void Sphere::donnerVolume(float& v){
v = (4/3)*3.14*radius*radius*radius;
}
void Sphere::miseEchelle(float f){
radius = f*radius;
}
int Sphere::compare(Sphere S){
float rS, vS, v;
S.lire_radius(rS);
vS = (4/3)*3.14*rS*rS*rS;
v = (4/3)*3.14*radius*radius*radius;
if (v <= vS){
if (v == vS)
return 0;
else
return -1;
}
else
return 1;
}
Aucun commentaire:
Enregistrer un commentaire