Sfoglia il codice sorgente

* img2rubik.c: improve stability by clipping t.

git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/libpipi/trunk@2734 92316355-f0b4-4df1-b90c-862c8a59935f
remotes/tiles
sam 16 anni fa
parent
commit
f6e201c341
1 ha cambiato i file con 3 aggiunte e 0 eliminazioni
  1. +3
    -0
      examples/img2rubik.c

+ 3
- 0
examples/img2rubik.c Vedi File

@@ -422,6 +422,9 @@ int main(int argc, char *argv[])
double yb = rgbhull->pts[slice][(n + 1) % count][Y];
double t = (xp * (yb - ya) - yp * (xb - xa)) / (xa * yb - xb * ya);

if(t > 1.0)
t = 1.0;

debug(" best RGB %g (%g,%g) (%g,%g)\n", t, xa, ya, xb, yb);

/* 2. apply the excentricity in reduced space. */


Caricamento…
Annulla
Salva