1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 # This software is governed by the CeCILL-B license under French law and
10 # abiding by the rules of distribution of free software. You can use,
11 # modify and/ or redistribute the software under the terms of the CeCILL-B
12 # license as circulated by CEA, CNRS and INRIA at the following URL
13 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 # or in the file LICENSE.txt.
16 # As a counterpart to the access to the source code and rights to copy,
17 # modify and redistribute granted by the license, users are provided only
18 # with a limited warranty and the software's author, the holder of the
19 # economic rights, and the successive licensors have only limited
22 # The fact that you are presently reading this means that you have had
23 # knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
26 // marVector.h: interface for the marVector class.
28 //////////////////////////////////////////////////////////////////////
36 Remarque : les (double*) sont organis�s ligne par ligne
38 /*==Constructeurs========================================*/
39 marVector(size_t s=3);
40 marVector(double* v,size_t s);
41 marVector(const marVector & v);
42 /*==Destructeur========================================*/
45 /*==Op�rateurs========================================*/
47 marVector& operator=(const marVector& o);
48 marVector& operator=(double o);
49 marVector& operator=(double* o);
52 friend std::ostream& operator<<(std::ostream& os, const marVector& v);
55 operator double*() const ;
58 double& operator()(size_t i);
59 const double& operator()(size_t i) const;
62 bool operator==(const marVector& o) const;
63 bool operator!=(const marVector& o) const;
66 marVector operator+(const marVector& o);
67 marVector operator+(double o);
68 marVector operator+(double* o);
69 /* Addition + Affectation */
70 marVector& operator+=(const marVector& o);
71 marVector& operator+=(double o);
72 marVector& operator+=(double* o);
75 marVector operator-(const marVector& o);
76 marVector operator-(double o);
77 marVector operator-(double* o);
78 /* Soustraction + Affectation */
79 marVector& operator-=(const marVector& o);
80 marVector& operator-=(double o);
81 marVector& operator-=(double* o);
83 /* Multiplication (produit scalaire) */
84 marVector operator*(double o);
85 /* Multiplication (produit scalaire) + Affectation */
86 marVector& operator*=(double o);
88 /* Division (division scalaire) */
89 marVector operator/(double o);
90 /* Division (division scalaire) + Affectation */
91 marVector& operator/=(double o);
93 /*==Op�rations========================================*/
94 /* produit scalaire */
95 double dot( const marVector& o );
96 double dot( double* o );
98 /* produit vectoriel (3D uniquement): le resultat est renvoye */
99 marVector cross( const marVector& o );
100 marVector cross( double* o );
101 /* produit vectoriel (3D uniquement): le resultat est stock� dans this*/
102 int scross( const marVector& o ); // renvoie 0 si OK, 1 sinon
103 int scross( double* o ); // renvoie 0 si OK, 1 sinon
105 /* norme euclidienne */
109 marVector normalize( ); // resultat renvoy�
110 int snormalize( ); // resultat stock� dans this, renvoie 0 si OK, 1 sinon
112 /*==M�thodes========================================*/
115 /*==Attributs========================================*/
117 bool shallowCopy; // true if _data is a shallow copy of original data (pointer copy)