1 // marVector.h: interface for the marVector class.
3 //////////////////////////////////////////////////////////////////////
11 Remarque : les (double*) sont organisés ligne par ligne
13 /*==Constructeurs========================================*/
14 marVector(size_t s=3);
15 marVector(double* v,size_t s);
16 marVector(const marVector & v);
17 /*==Destructeur========================================*/
20 /*==Opérateurs========================================*/
22 marVector& operator=(const marVector& o);
23 marVector& operator=(double o);
24 marVector& operator=(double* o);
27 friend std::ostream& operator<<(std::ostream& os, const marVector& v);
30 operator double*() const ;
33 double& operator()(size_t i);
34 const double& operator()(size_t i) const;
37 bool operator==(const marVector& o) const;
38 bool operator!=(const marVector& o) const;
41 marVector operator+(const marVector& o);
42 marVector operator+(double o);
43 marVector operator+(double* o);
44 /* Addition + Affectation */
45 marVector& operator+=(const marVector& o);
46 marVector& operator+=(double o);
47 marVector& operator+=(double* o);
50 marVector operator-(const marVector& o);
51 marVector operator-(double o);
52 marVector operator-(double* o);
53 /* Soustraction + Affectation */
54 marVector& operator-=(const marVector& o);
55 marVector& operator-=(double o);
56 marVector& operator-=(double* o);
58 /* Multiplication (produit scalaire) */
59 marVector operator*(double o);
60 /* Multiplication (produit scalaire) + Affectation */
61 marVector& operator*=(double o);
63 /* Division (division scalaire) */
64 marVector operator/(double o);
65 /* Division (division scalaire) + Affectation */
66 marVector& operator/=(double o);
68 /*==Opérations========================================*/
69 /* produit scalaire */
70 double dot( const marVector& o );
71 double dot( double* o );
73 /* produit vectoriel (3D uniquement): le resultat est renvoye */
74 marVector cross( const marVector& o );
75 marVector cross( double* o );
76 /* produit vectoriel (3D uniquement): le resultat est stocké dans this*/
77 int scross( const marVector& o ); // renvoie 0 si OK, 1 sinon
78 int scross( double* o ); // renvoie 0 si OK, 1 sinon
80 /* norme euclidienne */
84 marVector normalize( ); // resultat renvoyé
85 int snormalize( ); // resultat stocké dans this, renvoie 0 si OK, 1 sinon
87 /*==Méthodes========================================*/
90 /*==Attributs========================================*/
92 bool shallowCopy; // true if _data is a shallow copy of original data (pointer copy)