#include "smlxmatrix.h"
SMLXSpatialVector is a derivative class and inherits SMLXMatrix class. This class represents spatial vectors with sizes ranging from 1 to 6. Methods of this class allow to access components of spatial vector, define its size (number of elements), length and square of the length, create spatial vector from matrix. All operations with spatial vectors may be performed with 1-column matrices, but separate class for vectors gives advantages of direct access to vector's elements using one index via public member vec.
float vec[6];
Defines components of the current vector.
[top]
SMLLIBENTRY SMLXSpatialVector();
Default SMLXSpatialVector object constructor. Defines vector of size 6.
Example:
SMLXSpatialVector A();
This constructor has not any input
[top]
SMLLIBENTRY SMLXSpatialVector(const SMLVec3f& A);
SMLXSpatialVector object constructor from SMLVec3f object. Defines vector of size 3.
Example:
float crd[3] = {1, 3, 2};
SMLVec3f A(crd);
SMLXSpatialVector B(A);
A -reference to constant object SMLVec3f, which is used to create this SMLXSpatialVector.
[top]
SMLLIBENTRY SMLXSpatialVector(const SMLVec4f& A);
SMLXSpatialVector object constructor from SMLVec4f object. Defines vector of size 4.
Example:
float crd[4] = {1, 3, 2, 1};
SMLVec4f A(crd);
SMLXSpatialVector B(A);
A -reference to constant object SMLVec4f, which is used to create this SMLXSpatialVector.
[top]
SMLLIBENTRY SMLXSpatialVector(const SMLXMatrix& A);
SMLXSpatialVector object constructor from SMLXMatrix object. Defines vector of size A.nrows(), while A.ncols() is assumed to be equal 1.
Example:
float crd[6] = {1, 3, 2, 1, 3, 6};
SMLXMatrix A(6, 1, crd);
SMLXSpatialVector B(A);
A -reference to constant object SMLXMatrix, which is used to create this SMLXSpatialVector.
[top]
SMLLIBENTRY SMLXSpatialVector(const SMLXSpatialVector& A);
SMLXSpatialVector object copy-constructor.
Example:
float crd[6] = {1, 3, 2, 1, 3, 6}; SMLXSpatialVector A(crd);
SMLXSpatialVector B(A);
A - reference to constant SMLXSpatialVector object-copy, which is used to create this SMLXSpatialVector.
[top]
SMLLIBENTRY explicit SMLXSpatialVector(const float* initialValues);
Explicit SMLXSpatialVector object constructor. Defines vector of size 6 and sets it by using values from float array initialValues.
Example:
float crd[6] = {1, 3, 2, 1, 3, 6}; SMLXSpatialVector B(crd);
initialValues - initial values for the vector.
[top]
SMLLIBENTRY explicit SMLXSpatialVector(float value);
Explicit SMLXSpatialVector object constructor. Defines vector of size 1 and sets it to parameter value.
Example:
SMLXSpatialVector B(1.0f);
value - initial value for 1x1 vector.
[top]
SMLLIBENTRY SMLXSpatialVector(float, float);
SMLXSpatialVector object constructor. Created spatial vector from two elements.
Example:
SMLXSpatialVector B(1.0f, 2.0f);
1st parameter - 1st vector element.
2nd parameter - 2nd vector element.
[top]
SMLLIBENTRY SMLXSpatialVector(float, float, float);
SMLXSpatialVector object constructor. Created spatial vector from three elements.
Example:
SMLXSpatialVector B(1.0f, 2.0f, 1.0f);
1st parameter - 1st vector element.
2nd parameter - 2nd vector element.
3rd parameter - 3rd vector element.
[top]
SMLLIBENTRY SMLXSpatialVector(float, float, float, float);
SMLXSpatialVector object constructor. Created spatial vector from four elements.
Example:
SMLXSpatialVector B(1.0f, 2.0f, 1.0f, 3.0f);
1st parameter - 1st vector element.
2nd parameter - 2nd vector element.
3rd parameter - 3rd vector element.
4th parameter - 4th vector element.
[top]
SMLLIBENTRY SMLXSpatialVector(float, float, float, float, float);
SMLXSpatialVector object constructor. Created spatial vector from five elements.
Example:
SMLXSpatialVector B(1.0f, 2.0f, 1.0f, 3.0f, 2.0f);
1st parameter - 1st vector element.
2nd parameter - 2nd vector element.
3rd parameter - 3rd vector element.
4th parameter - 4th vector element.
5th parameter - 5th vector element.
[top]
SMLLIBENTRY SMLXSpatialVector(float, float, float, float, float, float);
SMLXSpatialVector object constructor. Created spatial vector from six elements.
Example:
SMLXSpatialVector B(1.0f, 2.0f, 1.0f, 3.0f, 2.0f, 5.0f);
1st parameter - 1st vector element.
2nd parameter - 2nd vector element.
3rd parameter - 3rd vector element.
4th parameter - 4th vector element.
5th parameter - 5th vector element.
6th parameter - 6th vector element.
[top]
SMLLIBENTRY void operator*=(float scale);
Method is an overloaded operator-function. It computes product of this vector and variable scale. The result is assigned to this vector.
Example:
float crd[6] = {1, 3, 2, 1, 1, 4};
SMLXSpatialVector A(crd);
A *= 2.0f
scale - multiplier.
No.
[top]
SMLLIBENTRY void operator=(const SMLXMatrix& A);
Method is an overloaded operator-function. This SMLXSpatialVector object is initialized by values from matrix A. Size of this vector is set to A.nrows(), while A.ncols() is assumed to be equal 1.
Example:
float crd[6] = {1, 3, 2, 1, 1, 4};
SMLXSpatialVector A(crd), B;
B = A;
A - reference to constant SMLXMatrix object which is used for initializing of this spatial vector.
No.
[top]
SMLLIBENTRY void operator=(const SMLXSpatialVector& A);
Method is an overloaded operator-function. This SMLXSpatialVector object is initialized by values from vector A.
A - reference to constant SMLXSpatialVector.
No.
[top]
SMLLIBENTRY int Size() const;
Returns a size of the spatial vector (number from 1 to 6).
Example:
int sz, crd[6] = {1, 3, 2, 1, 1, 4};
SMLXSpatialVector A(crd), sz = A.Size();
No.
Number of vector elements.
[top]
SMLLIBENTRY float LengthSquared() const;
Computes a square of the length of this spatial vector.
Example:
float ls;
SMLXSpatialVector A(3,4,5,8,1,2); ls = A.LengthSquared();
No.
Square of the length of the spatial vector.
[top]
SMLLIBENTRY float Length() const;
Computes length of this spatial vector.
Example:
float l;
SMLXSpatialVector A(3,4,5,8,2,1); l = A.Length();
No.
Length of the spatial vector.
[top]
SMLLIBENTRY SMLVec3f& Angular()
SMLLIBENTRY const SMLVec3f& Angular() const;
Returns angular components of this spatial vector (first 3 elements of the vector). Method is valid only for 6X1 vectors.
Example:
float *ang;
SMLXSpatialVector A(3,4,5,8,2,1); ang = A.Angular();
No.
Reference to SMLVec3f object (3 element-vector) representing angular components of this vector.
[top]
SMLLIBENTRY SMLVec3f& Linear();
SMLLIBENTRY const SMLVec3f& Linear() const;
Returns linear components of this spatial vector (last 3 elements of the vector). Method is defined only for 6X1 vectors.
Example:
float *lin;
SMLXSpatialVector A(3,4,5,8,2,1); lin = A.Linear();
No.
Reference to SMLVec3f object (3 element-vector) representing linear components of this vector.
[top]
SMLLIBENTRY void AdjustSize(short nrow);
Sets spatial vector size to be equal nrow.
nrow - number of vector elements.
No.
[top]
SMLLIBENTRY void Copy(const SMLXMatrix& A, int row = 0);
Copies row of matrix A into this vector.
A - reference to SMLXMatrix (source).
row - rows number to be copied into this vector.
No.
[top]