[SML Overview]

# class SMLXSpatialVector: public SMLXMatrix

    #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.

## Public Interface

constructors | Size | LengthSquared
Length | Angular | Linear
Copy | operator*= | Operator=

## Public Data

float vec[6];

Defines components of the current vector.

[top]

SMLLIBENTRY SMLXSpatialVector();

#### Discussion

Default SMLXSpatialVector object constructor. Defines vector of size 6.

Example:

    SMLXSpatialVector A();

#### Parameters

This constructor has not any input

#### Parameters

[top]

SMLLIBENTRY SMLXSpatialVector(const SMLVec3f& A);

#### Discussion

SMLXSpatialVector object constructor from SMLVec3f object. Defines vector of size 3.

Example:

    float crd[3] = {1, 3, 2};
    SMLVec3f A(crd);
    SMLXSpatialVector B(A);

#### Parameters

A -reference to constant object SMLVec3f, which is used to create this SMLXSpatialVector.

[top]

SMLLIBENTRY SMLXSpatialVector(const SMLVec4f& A);

#### Discussion

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);

#### Parameters

A -reference to constant object SMLVec4f, which is used to create this SMLXSpatialVector.

[top]

SMLLIBENTRY SMLXSpatialVector(const SMLXMatrix& A);

#### Discussion

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);

#### Parameters

A -reference to constant object SMLXMatrix, which is used to create this SMLXSpatialVector.

[top]

SMLLIBENTRY SMLXSpatialVector(const SMLXSpatialVector& A);

#### Discussion

SMLXSpatialVector object copy-constructor.

Example:

    float crd[6] = {1, 3, 2, 1, 3, 6}; SMLXSpatialVector A(crd);
    SMLXSpatialVector B(A);

#### Parameters

A - reference to constant SMLXSpatialVector object-copy, which is used to create this SMLXSpatialVector.

[top]

SMLLIBENTRY explicit SMLXSpatialVector(const float* initialValues);

#### Discussion

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);

#### Parameters

initialValues - initial values for the vector.

[top]

SMLLIBENTRY explicit SMLXSpatialVector(float value);

#### Discussion

Explicit SMLXSpatialVector object constructor. Defines vector of size 1 and sets it to parameter value.

Example:

    SMLXSpatialVector B(1.0f);

#### Parameters

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);

#### Parameters

1st parameter - 1st vector element.

2nd parameter - 2nd vector element.

[top]

SMLLIBENTRY SMLXSpatialVector(float, float, float);

#### Discussion

SMLXSpatialVector object constructor. Created spatial vector from three elements.

Example:

    SMLXSpatialVector B(1.0f, 2.0f, 1.0f);

#### Parameters

1st parameter - 1st vector element.

2nd parameter - 2nd vector element.

3rd parameter - 3rd vector element.

[top]

SMLLIBENTRY SMLXSpatialVector(float, float, float, float);

#### Discussion

SMLXSpatialVector object constructor. Created spatial vector from four elements.

Example:

    SMLXSpatialVector B(1.0f, 2.0f, 1.0f, 3.0f);

#### Parameters

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);

#### Discussion

SMLXSpatialVector object constructor. Created spatial vector from five elements.

Example:

    SMLXSpatialVector B(1.0f, 2.0f, 1.0f, 3.0f, 2.0f);

#### Parameters

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);

#### Discussion

SMLXSpatialVector object constructor. Created spatial vector from six elements.

Example:

    SMLXSpatialVector B(1.0f, 2.0f, 1.0f, 3.0f, 2.0f, 5.0f);

#### Parameters

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);

#### Discussion

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

#### Parameters

scale - multiplier.

#### Return Value

No.

[top]

SMLLIBENTRY void operator=(const SMLXMatrix& A);

#### Discussion

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;

#### Parameters

A - reference to constant SMLXMatrix object which is used for initializing of this spatial vector.

#### Return Value

No.

[top]

SMLLIBENTRY void operator=(const SMLXSpatialVector& A);

#### Discussion

Method is an overloaded operator-function. This SMLXSpatialVector object is initialized by values from vector A.

#### Parameters

A - reference to constant SMLXSpatialVector.

#### Return Value

No.

[top]

SMLLIBENTRY int Size() const;

#### Discussion

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();

#### Parameters

No.

#### Return Value

Number of vector elements.

[top]

SMLLIBENTRY float LengthSquared() const;

#### Discussion

Computes a square of the length of this spatial vector.

Example:

    float ls;
    SMLXSpatialVector A(3,4,5,8,1,2); ls = A.LengthSquared();

#### Parameters

No.

#### Return Value

Square of the length of the spatial vector.

[top]

SMLLIBENTRY float Length() const;

#### Discussion

Computes length of this spatial vector.

Example:

    float l;
    SMLXSpatialVector A(3,4,5,8,2,1); l = A.Length();

#### Parameters

No.

#### Return Value

Length of the spatial vector.

[top]

SMLLIBENTRY SMLVec3f& Angular()

SMLLIBENTRY const SMLVec3f& Angular() const;

#### Discussion

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();

#### Parameters

No.

#### Return Value

Reference to SMLVec3f object (3 element-vector) representing angular components of this vector.

[top]

SMLLIBENTRY SMLVec3f& Linear();

SMLLIBENTRY const SMLVec3f& Linear() const;

#### Discussion

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();

#### Parameters

No.

#### Return Value

Reference to SMLVec3f object (3 element-vector) representing linear components of this vector.

[top]

SMLLIBENTRY void AdjustSize(short nrow);

#### Discussion

Sets spatial vector size to be equal nrow.

#### Parameters

nrow - number of vector elements.

#### Return Value

No.

[top]

SMLLIBENTRY void Copy(const SMLXMatrix& A, int row = 0);

#### Discussion

Copies row of matrix A into this vector.

#### Parameters

A - reference to SMLXMatrix (source).

row - rows number to be copied into this vector.

#### Return Value

No.

[top]