36 T* slice = (T*)
OVR_ALLOC(this->ElemCount *
sizeof(T));
38 for (
int coord = 0; coord < 3; coord++)
40 for (
int i = 0; i < this->ElemCount; i++)
41 slice[i] = this->Data[i][coord];
55 for (
int i = 0; i < this->ElemCount; i++)
57 total.
x += (this->Data[i].x - mean.
x) * (this->Data[i].x - mean.
x);
58 total.
y += (this->Data[i].y - mean.
y) * (this->Data[i].y - mean.
y);
59 total.
z += (this->Data[i].z - mean.
z) * (this->Data[i].z - mean.
z);
61 return total / (float) this->ElemCount;
69 for (
int i = 0; i < this->ElemCount; i++)
71 total.
M[0][0] += (this->Data[i].x - mean.
x) * (this->Data[i].x - mean.
x);
72 total.
M[1][0] += (this->Data[i].y - mean.
y) * (this->Data[i].x - mean.
x);
73 total.
M[2][0] += (this->Data[i].z - mean.
z) * (this->Data[i].x - mean.
x);
74 total.
M[1][1] += (this->Data[i].y - mean.
y) * (this->Data[i].y - mean.
y);
75 total.
M[2][1] += (this->Data[i].z - mean.
z) * (this->Data[i].y - mean.
y);
76 total.
M[2][2] += (this->Data[i].z - mean.
z) * (this->Data[i].z - mean.
z);
78 total.
M[0][1] = total.
M[1][0];
79 total.
M[0][2] = total.
M[2][0];
80 total.
M[1][2] = total.
M[2][1];
81 for (
int i = 0; i < 3; i++)
82 for (
int j = 0; j < 3; j++)
83 total.
M[i][j] /= (
float) this->ElemCount;
92 pearson.
x = cov.
M[0][1]/(sqrt(cov.
M[0][0])*sqrt(cov.
M[1][1]));
93 pearson.
y = cov.
M[1][2]/(sqrt(cov.
M[1][1])*sqrt(cov.
M[2][2]));
94 pearson.
z = cov.
M[2][0]/(sqrt(cov.
M[2][2])*sqrt(cov.
M[0][0]));
Vector3< T > Median() const
Matrix3< T > Covariance() const
Vector3< T > PearsonCoefficient() const
Vector3< T > Variance() const
Array::ValueType & Median(Array &arr)