diff --git a/examples/img2rubik.c b/examples/img2rubik.c index 12a15d1..70dd563 100644 --- a/examples/img2rubik.c +++ b/examples/img2rubik.c @@ -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. */