![]() |
JSBSim Flight Dynamics Model 1.0 (23 February 2013)
An Open Source Flight Dynamics and Control Software Library in C++
|
This class implements a 3 element column vector. More...
#include <FGColumnVector3.h>
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. | |
| FGColumnVector3 & | Normalize (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. | |
| FGColumnVector3 & | operator*= (const double scalar) |
| Scale by a scalar. | |
| FGColumnVector3 | operator+ (const FGColumnVector3 &B) const |
| Addition operator. | |
| FGColumnVector3 & | operator+= (const FGColumnVector3 &B) |
| Add an other vector. | |
| FGColumnVector3 | operator- (const FGColumnVector3 &B) const |
| Subtraction operator. | |
| FGColumnVector3 & | operator-= (const FGColumnVector3 &B) |
| Subtract an other vector. | |
| FGColumnVector3 | operator/ (const double scalar) const |
| Multiply by 1/scalar. | |
| FGColumnVector3 & | operator/= (const double scalar) |
| Scale by a 1/scalar. | |
| FGColumnVector3 & | operator= (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. | |
Definition at line 70 of file FGColumnVector3.h.
| 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] |
| X | value of the x-conponent. |
| Y | value of the y-conponent. |
| Z | value 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] |
| v | Vector 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];
}
| string Dump | ( | const std::string & | delimeter | ) | const |
| delimeter | the item separator (tab or comma) |
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] |
| idx | the 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] |
| idx | the 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 | ( | void | ) | const |
Compute and return the euclidean norm of this vector.
Definition at line 111 of file FGColumnVector3.cpp.
Referenced by FGPropeller::Calculate(), FGPropagate::GetInertialVelocityMagnitude(), FGInitialCondition::GetVgroundFpsIC(), FGInitialCondition::GetWindFpsIC(), FGInitialCondition::ResetIC(), FGMassBalance::Run(), FGAuxiliary::Run(), FGInitialCondition::SetCrossWindKtsIC(), FGInitialCondition::SetHeadWindKtsIC(), FGLocation::SetLatitude(), FGLocation::SetLongitude(), FGLocation::SetRadius(), FGInitialCondition::SetVgroundFpsIC(), FGInitialCondition::SetWindDirDegIC(), FGInitialCondition::SetWindDownKtsIC(), FGInitialCondition::SetWindMagKtsIC(), and FGInitialCondition::SetWindNEDFpsIC().
{
return sqrt( data[0]*data[0] + data[1]*data[1] + data[2]*data[2] );
}
Here is the caller graph for this function:| 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] |
| b | other 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] |
| idx | the 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] |
| idx | the 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] |
| scalar | scalar value to multiply the vector with. |
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] |
| V | vector to multiply with. |
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 |
| scalar | scalar value to devide the vector through. |
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] |
| b | source 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] |
| b | other 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: