diff --git a/src/modules/Image/polyfill.c b/src/modules/Image/polyfill.c index b91a2b08cab865ec6b1f11f9f85ee6b5de917b8d..c2822c60cd006a889ef780cd6bd1bfe3a081efba 100644 --- a/src/modules/Image/polyfill.c +++ b/src/modules/Image/polyfill.c @@ -28,7 +28,7 @@ extern double floor(double); /* **! module Image **! note -**! $Id: polyfill.c,v 1.5 1997/08/30 18:36:09 grubba Exp $<br> +**! $Id: polyfill.c,v 1.6 1997/10/06 15:02:13 grubba Exp $<br> **! class image */ @@ -90,28 +90,31 @@ static void vertex_connect(struct vertex *above, struct vertex *below) { struct vertex_list *c,*d; + float diff; if (below==above) return; - c=malloc(sizeof(struct vertex_list)); - c->above=above; c->below=below; - c->next=above->below; - if (below->y!=above->y) - c->dx=(below->x-above->x)/(below->y-above->y); + c = malloc(sizeof(struct vertex_list)); + c->above = above; c->below = below; + c->next = above->below; + if (((diff = (below->y - above->y)) < 1.0e-10) && + (diff > -1.0e-10)) + c->dx = 1.0e10; else - c->dx=1e10; - if (below->x!=above->x) - c->dy=(below->y-above->y)/(below->x-above->x); + c->dx = (below->x - above->x)/diff; + if (((diff = (below->x - above->x)) < 1.0e-10) && + (diff > -1.0e-10)) + c->dy = 1.0e10; else - c->dy=1e10; - above->below=c; - - d=malloc(sizeof(struct vertex_list)); - d->above=above; d->below=below; - d->next=below->above; - d->dx=c->dx; - d->dy=c->dy; - below->above=d; + c->dy = (below->y - above->y)/diff; + above->below = c; + + d = malloc(sizeof(struct vertex_list)); + d->above = above; d->below = below; + d->next = below->above; + d->dx = c->dx; + d->dy = c->dy; + below->above = d; } static INLINE float vertex_xmax(struct vertex_list *v,float yp,float *ydest)