From e865c87f9102e646e6c13d9005b288e4ede5c7d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?= <grubba@grubba.org> Date: Mon, 6 Oct 1997 17:02:13 +0200 Subject: [PATCH] Improved check for vertical vertices. Rev: src/modules/Image/polyfill.c:1.6 --- src/modules/Image/polyfill.c | 39 +++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/src/modules/Image/polyfill.c b/src/modules/Image/polyfill.c index b91a2b08ca..c2822c60cd 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) -- GitLab