Posting here since it effects .Net also.
ARX documentation AcGeMatrix2d::scale Function double
scale();
Returns scale factor of matrix. The returned scale is the square root of the maximum length of the two column vectors.
This API is returning the length of row vector 0 only. The AcGeMatrix3d version works correctly.
The test fails
bool TestAcGematrix2d(void)
{
bool bError = false;
// Test AcGeMatrix2d::scale function
AcGeMatrix2d mat2d;
for(int i = 0; i < 5; ++i) {
for(int j = 0; j < 5; ++j) {
for(int k = 0; k < 5; ++k) {
for(int l = 0; l < 5; ++l) {
mat2d.entry[0][0] = i; mat2d.entry[0][1] = j;
mat2d.entry[1][0] = k; mat2d.entry[1][1] = l;
double dMatScale = mat2d.scale();
double dRow1Length = sqrt((double) (i * i) + (k * k));
double dRow2Length = sqrt((double) (j * j) + (l * l));
if(max(dRow1Length, dRow2Length) == dMatScale)
acutPrintf("\n Correct - ");
else {
acutPrintf("\nIncorrect - ");
bError = true;
}
acutPrintf("Matrix Scale = %.2f, calced row 1 = %.2f, calced row 2 = %.2f",
dMatScale, dRow1Length, dRow2Length);
}
}
}
}
return bError
}
This test passes
bool TestAcGeMatrix3d(void)
{
// Test AcGeMatrix3d::scale function
bool bError = false;
AcGeMatrix3d mat3d;
for(int i = 0; i < 5; ++i) {
for(int j = 0; j < 5; ++j) {
for(int k = 0; k < 5; ++k) {
for(int l = 0; l < 5; ++l) {
mat3d.entry[0][0] = i; mat3d.entry[0][1] = j;
mat3d.entry[1][0] = k; mat3d.entry[1][1] = l;
double dMatScale = mat3d.scale();
double dRow1Length = sqrt((double) (i * i) + (k * k));
double dRow2Length = sqrt((double) (j * j) + (l * l));
if(max(dRow1Length, dRow2Length) == dMatScale)
acutPrintf("\n Correct - ");
else {
acutPrintf("\nIncorrect - ");
bError = true;
}
acutPrintf("Matrix Scale = %.2f, calced row 1 = %.2f, calced row 2 = %.2f",
dMatScale, dRow1Length, dRow2Length);
}
}
}
}
return bError;
}