czxlegrand / lib3ds

Automatically exported from code.google.com/p/lib3ds
GNU Lesser General Public License v2.1
0 stars 0 forks source link

some notes about 20080909 lib3ds version #7

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hello,
here some notes about 20080909 lib3ds version:

1.  (main) (result: incorrect vertices positions calculation)
#define LIB3DS_EPSILON (1e-8)
// original define #define LIB3DS_EPSILON  (1e-5)
1e-5 is too large value for the matrix calculation in the float range.
in case of 1e-5  use sometimes  lib3ds_matrix_inv function fails,
because of return in this case:
  if (fabs(determinat)<LIB3DS_EPSILON) {   
      return(0);  /* Matrix is singular (zero determinant) */

(if you need I can send you a 3ds file which gives incorrect result)

2. (minor)
function lib3ds_vector_neg(float c[3]) does not have implementation in the
lib3ds_vector.c file.

3. (minor)
lib3ds_matrix_mult(float m[4][4], float a[4][4], float b[4][4]) {
    float tmp[4][4]; // should be removed
    int i, j, k;
    float ab;

    memcpy(tmp, a, 16 * sizeof(float)); // should be removed and 'a' matrix
should be used
    for (j = 0; j < 4; j++) {
        for (i = 0; i < 4; i++) {
            ab = 0.0f;
            for (k = 0; k < 4; k++) ab += tmp[k][i] * b[j][k];
            m[j][i] = ab;
        }
    }
}

Tomas

Original issue reported on code.google.com by jkypr...@gmail.com on 1 Feb 2010 at 7:52