12 enum STANDARD_BASIS
{e1
, e2
, e3
}; //Particular vector of R3, e1 = (1 0 0 ), e2 = (0 1 0), e3 = (0 0 1)
13 enum DOT_PRODUCT_TYPE
{EUCLID
, W_EUCLID
}; //Specify which scalar product is to be used (euclidian, weighted euclidian, etc).
16 Vector3 (const double cmp1
, const double cmp2
, const double cmp3
);
17 Vector3 (STANDARD_BASIS aVector
); //To instantiate a particular vector of R3
18 Vector3 (double components
[]);
19 Vector3 (const Vector3
&otherVector
);
24 void setVector (const double cmp1
= 0, const double cmp2
= 0, const double cmp3
= 0);
28 All operators can throw logic_error exceptions*/
29 void operator = (const Vector3
&otherVector
);
31 Vector3
operator + (const Vector3
&otherVector
) const;
32 Vector3
& operator += (const Vector3
&otherVector
);
34 Vector3
operator - (const Vector3
&otherVector
) const;
35 Vector3
& operator -= (const Vector3
&otherVector
);
37 Vector3
operator * (const double scalar
) const; //External product
38 Vector3
& operator *= (const double scalar
);
40 double operator * (const Vector3
&otherVector
) const; //Dot product of 2 vector3
41 double operator *= (const Vector3
&otherVector
) const;
43 //Can throw domain_error exceptions
44 Vector3
operator / (const double scalar
) const;
45 Vector3
& operator /= (const double scalar
);
47 Vector3
operator ^ (const Vector3
&otherVector
) const; //Cross product of 2 vector3
49 bool operator == (const Vector3
&otherVector
) const;
50 bool operator != (const Vector3
&otherVector
) const;
52 /*Can throw out_of_range exceptions
53 /!\ index is understood as a mathematical index, not as a general C++ index /!\
54 See method 'at()' for the C++ like getter/setter*/
55 double operator [] (const unsigned int index
) const;
56 double& operator [] (const unsigned int index
);
58 /*Can throw out_of_range exception
59 C++ like getter/setter*/
60 double at (const unsigned int index
) const;
61 double& at (const unsigned int index
);
63 friend std::ostream
& operator<< (std::ostream
& os
, const Vector3
&aVector
);
67 double dotProduct (const Vector3
&otherVector
, const DOT_PRODUCT_TYPE dpType
= EUCLID
,
68 const double w1
= 1, const double w2
= 1, const double w3
= 1) const;
69 double magnitude () const;
70 double magnitude2 () const;