portfolio/vague/point3D.h
thierry_nibert 5b6730b2dc add files
2026-08-01 16:49:57 +02:00

61 lines
1.5 KiB
C++
Executable File

#ifndef _point3D_H
#define _point3D_H
#include <iostream>
using namespace std ;
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
/******************* point3D ******************/
/**
* @brief The point3D class
* stock les coordonées 3d d'un point
*
*/
class point3D{
public:
double x;
double y;
double z;
point3D(); // (0,0,0) par defaut
point3D(const double, const double, const double=0.0);
bool operator==(const point3D &)const;
point3D& operator=(const point3D &);
point3D operator+(const point3D &)const;
point3D operator-(const point3D &)const;
point3D& operator*=(const double); //produit par un scalaire
point3D operator*(const double)const; //idem
point3D operator*(const point3D)const; //produit par un scalaire entre
// coefficient retourne (x*x1, y*y1, z*z1)
point3D& operator/=(const double); //division par un scalaire
point3D operator/(const double)const; //idem
friend ostream& operator<<(ostream&, point3D);
friend istream& operator>>(istream&, point3D &);
// methode statique sur de vecteur3D declarer comme point3D
static double produit_scalaire(const point3D& _v1, const point3D& _v2); // produit scalaire vecteur 3D
static point3D produit_vectoriel(const point3D& _v1 , const point3D& _v2); //produit vectoriel
static point3D PointsToVecteur(const point3D& _p1, const point3D& _p2) ;
static void normalize(point3D& _v);
};
#endif