|Function||Center of gravity of a matrix with respect to the element indizes|
|Syntax C/C++||#include <MFstd.h>
fComplex MF_centerOfGravityInd( fMatrix MA, ui ht, ui len );
|C++ VecObj||#include <OptiVec.h>
procedure MF_centerOfGravityInd( var COG:fComplex; MA:fMatrix; ht, len:UIntSize );
|Description||The center of gravity of the matrix MA is determined. It is assumend that the values of MA represent point masses situated at the positions given by the element indices. The center of gravity is returned as a complex number whose real part contains the X coordinate and whose imaginary part contains the Y coordinate. Please note that this ordering of the coordinates is different from the ordering of matrix element indices (where the first index gives the i-th row, in other words, the Y coordinate). If all elements of MA are 0, there is no mass and, strictly speaking, no center of gravity. In this case, the center of gravity is assumed as the geometrical center of MA, i.e. as ( (len-1) / 2; ( (ht-1) / 2; ).
In order to calculate the center of gravity of an MZ matrix over explicitly given X-Y coordinates, call MF_centerOfGravityV.
|Return value||(Interpolated) coordinates of the center of gravity|
MatrixLib Table of Contents OptiVec home