JSBSim Flight Dynamics Model 1.0 (23 February 2013)
An Open Source Flight Dynamics and Control Software Library in C++

FGColumnVector3 Class Reference

This class implements a 3 element column vector. More...

#include <FGColumnVector3.h>

List of all members.

Public Member Functions

 FGColumnVector3 (void)
 Default initializer.
 FGColumnVector3 (const double X, const double Y, const double Z)
 Initialization by given values.
 FGColumnVector3 (const FGColumnVector3 &v)
 Copy constructor.
 ~FGColumnVector3 (void)
 Destructor.
std::string Dump (const std::string &delimeter) const
 Prints the contents of the vector.
double & Entry (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.
void InitMatrix (void)
void InitMatrix (const double a)
void InitMatrix (const double a, const double b, const double c)
double Magnitude (void) const
 Length of the vector.
double Magnitude (const int idx1, const int idx2) const
 Length of the vector in a coordinate axis plane.
FGColumnVector3Normalize (void)
 Normalize.
bool operator!= (const FGColumnVector3 &b) const
 Comparison operator.
double & operator() (const unsigned int idx)
 Write access the entries of the vector.
double operator() (const unsigned int idx) const
 Read access the entries of the vector.
FGColumnVector3 operator* (const double scalar) const
 Multiplication by a scalar.
FGColumnVector3 operator* (const FGColumnVector3 &V) const
 Cross product multiplication.
FGColumnVector3operator*= (const double scalar)
 Scale by a scalar.
FGColumnVector3 operator+ (const FGColumnVector3 &B) const
 Addition operator.
FGColumnVector3operator+= (const FGColumnVector3 &B)
 Add an other vector.
FGColumnVector3 operator- (const FGColumnVector3 &B) const
 Subtraction operator.
FGColumnVector3operator-= (const FGColumnVector3 &B)
 Subtract an other vector.
FGColumnVector3 operator/ (const double scalar) const
 Multiply by 1/scalar.
FGColumnVector3operator/= (const double scalar)
 Scale by a 1/scalar.
FGColumnVector3operator= (const FGColumnVector3 &b)
 Assignment operator.
bool operator== (const FGColumnVector3 &b) const
 Comparison operator.

Friends

double DotProduct (const FGColumnVector3 &v1, const FGColumnVector3 &v2)
 Dot product of two vectors Compute and return the euclidean dot (or scalar) product of two vectors v1 and v2.

Detailed Description

Author:
Jon S. Berndt, Tony Peden, et. al.
Version:
Id:
FGColumnVector3.h,v 1.17 2011/12/10 15:49:21 bcoconni Exp

Definition at line 70 of file FGColumnVector3.h.


Constructor & Destructor Documentation

FGColumnVector3 ( void  )

Create a zero vector.

Definition at line 57 of file FGColumnVector3.cpp.

Referenced by FGColumnVector3::operator*(), FGColumnVector3::operator+(), and FGColumnVector3::operator-().

{
  data[0] = data[1] = data[2] = 0.0;
  // Debug(0);
}

Here is the caller graph for this function:

FGColumnVector3 ( const double  X,
const double  Y,
const double  Z 
) [inline]
Parameters:
Xvalue of the x-conponent.
Yvalue of the y-conponent.
Zvalue of the z-conponent. Create a vector from the doubles given in the arguments.

Definition at line 82 of file FGColumnVector3.h.

                                                                  {
    data[0] = X;
    data[1] = Y;
    data[2] = Z;
  }
FGColumnVector3 ( const FGColumnVector3 v) [inline]
Parameters:
vVector which is used for initialization. Create copy of the vector given in the argument.

Definition at line 91 of file FGColumnVector3.h.

                                            {
    data[0] = v.data[0];
    data[1] = v.data[1];
    data[2] = v.data[2];
  }

Member Function Documentation

string Dump ( const std::string &  delimeter) const
Parameters:
delimeterthe item separator (tab or comma)
Returns:
a string with the delimeter-separated contents of the vector

Definition at line 65 of file FGColumnVector3.cpp.

Referenced by FGOutputSocket::Print().

{
  ostringstream buffer;
  buffer << std::setprecision(16) << data[0] << delimiter;
  buffer << std::setprecision(16) << data[1] << delimiter;
  buffer << std::setprecision(16) << data[2];
  return buffer.str();
}

Here is the caller graph for this function:

double Entry ( const unsigned int  idx) const [inline]
Parameters:
idxthe component index. Return the value of the matrix entry at the given index. Indices are counted starting with 1. This function is just a shortcut for the double operator()(unsigned int idx) const function. It is used internally to access the elements in a more convenient way. Note that the index given in the argument is unchecked.

Definition at line 122 of file FGColumnVector3.h.

Referenced by FGLocation::Entry(), and FGLocation::operator()().

{ return data[idx-1]; }

Here is the caller graph for this function:

double& Entry ( const unsigned int  idx) [inline]
Parameters:
idxthe component index. Return a reference to the vector entry at the given index. Indices are counted starting with 1. This function is just a shortcut for the double& operator()(unsigned int idx) function. It is used internally to access the elements in a more convenient way. Note that the index given in the argument is unchecked.

Definition at line 132 of file FGColumnVector3.h.

{ return data[idx-1]; }
double Magnitude ( const int  idx1,
const int  idx2 
) const

Compute and return the euclidean norm of this vector projected into the coordinate axis plane idx1-idx2.

Definition at line 130 of file FGColumnVector3.cpp.

                                                                      {
  return sqrt( data[idx1-1]*data[idx1-1] +  data[idx2-1]*data[idx2-1] );
}
FGColumnVector3 & Normalize ( void  )

Normalize the vector to have the Magnitude() == 1.0. If the vector is equal to zero it is left untouched.

Definition at line 118 of file FGColumnVector3.cpp.

Referenced by FGExternalForce::FGExternalForce(), FGDefaultGroundCallback::GetAGLevel(), and FGInitialCondition::SetBetaRadIC().

{
  double Mag = Magnitude();

  if (Mag != 0.0)
    operator*=( 1.0/Mag );

  return *this;
}

Here is the caller graph for this function:

bool operator!= ( const FGColumnVector3 b) const [inline]
Parameters:
bother vector. Returns false if both vectors are exactly the same.

Definition at line 159 of file FGColumnVector3.h.

References FGColumnVector3::operator==().

{ return ! operator==(b); }

Here is the call graph for this function:

double& operator() ( const unsigned int  idx) [inline]
Parameters:
idxthe component index. Return a reference to the vector entry at the given index. Indices are counted starting with 1. Note that the index given in the argument is unchecked.

Definition at line 112 of file FGColumnVector3.h.

{ return data[idx-1]; }
double operator() ( const unsigned int  idx) const [inline]
Parameters:
idxthe component index. Return the value of the matrix entry at the given index. Indices are counted starting with 1. Note that the index given in the argument is unchecked.

Definition at line 105 of file FGColumnVector3.h.

{ return data[idx-1]; }
FGColumnVector3 operator* ( const double  scalar) const [inline]
Parameters:
scalarscalar value to multiply the vector with.
Returns:
The resulting vector from the multiplication with that scalar. Multiply the vector with the scalar given in the argument.

Definition at line 165 of file FGColumnVector3.h.

References FGColumnVector3::FGColumnVector3().

                                                       {
    return FGColumnVector3(scalar*data[0], scalar*data[1], scalar*data[2]);
  }

Here is the call graph for this function:

FGColumnVector3 operator* ( const FGColumnVector3 V) const [inline]
Parameters:
Vvector to multiply with.
Returns:
The resulting vector from the cross product multiplication. Compute and return the cross product of the current vector with the given argument.

Definition at line 180 of file FGColumnVector3.h.

References FGColumnVector3::FGColumnVector3().

                                                            {
    return FGColumnVector3( data[1] * V.data[2] - data[2] * V.data[1],
                            data[2] * V.data[0] - data[0] * V.data[2],
                            data[0] * V.data[1] - data[1] * V.data[0] );
  }

Here is the call graph for this function:

FGColumnVector3 operator/ ( const double  scalar) const
Parameters:
scalarscalar value to devide the vector through.
Returns:
The resulting vector from the division through that scalar. Multiply the vector with the 1/scalar given in the argument.

Definition at line 84 of file FGColumnVector3.cpp.

{
  if (scalar != 0.0)
    return operator*( 1.0/scalar );

  cerr << "Attempt to divide by zero in method \
    FGColumnVector3::operator/(const double scalar), \
    object " << data[0] << " , " << data[1] << " , " << data[2] << endl;
  return FGColumnVector3();
}
FGColumnVector3& operator= ( const FGColumnVector3 b) [inline]
Parameters:
bsource vector. Copy the content of the vector given in the argument into *this.

Definition at line 142 of file FGColumnVector3.h.

                                                       {
    data[0] = b.data[0];
    data[1] = b.data[1];
    data[2] = b.data[2];
    return *this;
  }
bool operator== ( const FGColumnVector3 b) const [inline]
Parameters:
bother vector. Returns true if both vectors are exactly the same.

Definition at line 152 of file FGColumnVector3.h.

Referenced by FGColumnVector3::operator!=().

                                                  {
    return data[0] == b.data[0] && data[1] == b.data[1] && data[2] == b.data[2];
  }

Here is the caller graph for this function:


The documentation for this class was generated from the following files: