Browse Source

* 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 years ago
parent
commit
f6e201c341
1 changed files with 3 additions and 0 deletions
  1. +3
    -0
      examples/img2rubik.c

+ 3
- 0
examples/img2rubik.c View 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. */


Loading…
Cancel
Save