35 #ifndef FGCOLUMNVECTOR3_H 36 #define FGCOLUMNVECTOR3_H 49 #define ID_COLUMNVECTOR3 "$Id: FGColumnVector3.h,v 1.18 2013/11/30 10:25:33 bcoconni Exp $" 105 double operator()(
const unsigned int idx)
const {
return data[idx-1]; }
112 double&
operator()(
const unsigned int idx) {
return data[idx-1]; }
122 double Entry(
const unsigned int idx)
const {
return data[idx-1]; }
132 double&
Entry(
const unsigned int idx) {
return data[idx-1]; }
137 std::string
Dump(
const std::string& delimeter)
const;
153 return data[0] == b.data[0] && data[1] == b.data[1] && data[2] == b.data[2];
166 return FGColumnVector3(scalar*data[0], scalar*data[1], scalar*data[2]);
182 data[2] * V.data[0] - data[0] * V.data[2],
183 data[0] * V.data[1] - data[1] * V.data[0] );
188 return FGColumnVector3( data[0] + B.data[0], data[1] + B.data[1], data[2] + B.data[2] );
193 return FGColumnVector3( data[0] - B.data[0], data[1] - B.data[1], data[2] - B.data[2] );
198 data[0] -= B.data[0];
199 data[1] -= B.data[1];
200 data[2] -= B.data[2];
206 data[0] += B.data[0];
207 data[1] += B.data[1];
208 data[2] += B.data[2];
223 void InitMatrix(
void) { data[0] = data[1] = data[2] = 0.0; }
224 void InitMatrix(
const double a) { data[0] = data[1] = data[2] = a; }
225 void InitMatrix(
const double a,
const double b,
const double c) {
226 data[0]=a; data[1]=b; data[2]=c;
236 double Magnitude(
const int idx1,
const int idx2)
const;
251 return v1(1)*v2(1) + v1(2)*v2(2) + v1(3)*v2(3);
268 std::ostream& operator<<(std::ostream& os,
const FGColumnVector3& col);
FGColumnVector3 & operator=(const FGColumnVector3 &b)
Assignment operator.
FGColumnVector3(const FGColumnVector3 &v)
Copy constructor.
double operator()(const unsigned int idx) const
Read access the entries of the vector.
FGColumnVector3(const double X, const double Y, const double Z)
Initialization by given values.
FGColumnVector3 & operator+=(const FGColumnVector3 &B)
Add an other vector.
FGColumnVector3 & Normalize(void)
Normalize.
bool operator==(const FGColumnVector3 &b) const
Comparison operator.
FGColumnVector3 operator/(const double scalar) const
Multiply by 1/scalar.
double & Entry(const unsigned int idx)
Write access the entries of the vector.
FGColumnVector3 operator*(const FGColumnVector3 &V) const
Cross product multiplication.
FGColumnVector3 operator-(const FGColumnVector3 &B) const
Subtraction operator.
FGColumnVector3 operator*(const double scalar) const
Multiplication by a scalar.
FGColumnVector3 & operator/=(const double scalar)
Scale by a 1/scalar.
std::string Dump(const std::string &delimeter) const
Prints the contents of the vector.
FGColumnVector3 & operator*=(const double scalar)
Scale by a scalar.
double & operator()(const unsigned int idx)
Write access the entries of the vector.
double Entry(const unsigned int idx) const
Read access the entries of the vector.
FGColumnVector3 operator+(const FGColumnVector3 &B) const
Addition operator.
This class implements a 3 element column vector.
~FGColumnVector3(void)
Destructor.
double Magnitude(void) const
Length of the vector.
FGColumnVector3 & operator-=(const FGColumnVector3 &B)
Subtract an other vector.
bool operator!=(const FGColumnVector3 &b) const
Comparison operator.
FGColumnVector3(void)
Default initializer.