delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2014/01/16/01:51:11

X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f
X-Recipient: geda-user AT delorie DOT com
X-Envelope-From: paubert AT iram DOT es
Date: Thu, 16 Jan 2014 07:50:06 +0100
From: Gabriel Paubert <paubert AT iram DOT es>
To: geda-user AT delorie DOT com
Subject: Re: [geda-user] New router pictures
Message-ID: <20140116065006.GA3589@visitor2.iram.es>
References: <1389363489 DOT 2427 DOT 5 DOT camel AT AMD64X2 DOT fritz DOT box>
<lb11t3$v8m$1 AT ger DOT gmane DOT org>
<1389632128 DOT 2414 DOT 50 DOT camel AT AMD64X2 DOT fritz DOT box>
<52D4532C DOT 2040100 AT neurotica DOT com>
<1389653121 DOT 2066 DOT 15 DOT camel AT AMD64X2 DOT fritz DOT box>
<20140114074240 DOT GA2384 AT visitor2 DOT iram DOT es>
<52D59BDA DOT 2040008 AT zoot DOT drehmel DOT com>
MIME-Version: 1.0
In-Reply-To: <52D59BDA.2040008@zoot.drehmel.com>
User-Agent: Mutt/1.5.20 (2009-06-14)
X-Spamina-Bogosity: Unsure
X-Spamina-Spam-Score: -0.2 (/)
X-Spamina-Spam-Report: Content analysis details: (-0.2 points)
pts rule name description
---- ---------------------- --------------------------------------------------
-1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP
0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60%
[score: 0.5313]
Reply-To: geda-user AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: geda-user AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Tue, Jan 14, 2014 at 09:19:38PM +0100, Robert Drehmel wrote:
> On 01/14/2014 08:42 AM, Gabriel Paubert wrote:
> >It's certainly not related to the GL drawing, I also see it with the
> >lesstif interface. I believe that this is a polygon dicer bug, and that
> >the nm conversion has nothing to do with it.
> >
> >I have attached two files which show the bug. On the first one, the
> >bug disappears temporarily if you type th delete key (to remove the
> >selected line) and then "u" to undo the changes. But it reappears
> >after saving and reloading the file. On a board I'm designing, I got
> >quite a few instances of the bug.
> >
> >The second file is the simplest test case I could come up with: a
> >single 0603 resistor and a single line segment. It can't get much
> >simpler than that. Just select the line and copy it from the first
> >pad to the second and the bug repeats. It seems to be very reproducible.
> >
> >I've been trying to enable the polygon debug code, but I don't really
> >understand the output.
> 
> The attached patch fixes the provided test cases for me.  It merges
> the pad clearance polygons with the accumulated POLYAREA, instead of
> subtracting them directly.  It's quite possible that the patch is masking
> the bug by changing the order in which polygons are subtracted, though.

Thanks for the patch. It indeed fixes my testcases and the original
board from which I distilled them.

	Best regards,
	Gabriel

> 
> Best regards,
> Robert
> 

> diff --git a/src/polygon.c b/src/polygon.c
> index 5f17fd0..8204384 100644
> --- a/src/polygon.c
> +++ b/src/polygon.c
> @@ -107,6 +107,7 @@ dicer output is used for HIDs which cannot render things with holes
>  
>  #define UNSUBTRACT_BLOAT 10
>  #define SUBTRACT_PIN_VIA_BATCH_SIZE 100
> +#define SUBTRACT_PAD_BATCH_SIZE 100
>  #define SUBTRACT_LINE_BATCH_SIZE 20
>  
>  static double rotate_circle_seg[4];
> @@ -845,6 +846,15 @@ SubtractText (TextType * text, PolygonType * p)
>    return Subtract (np, p, true);
>  }
>  
> +static POLYAREA *
> +PadPoly (PadType * pad)
> +{
> +  if (TEST_FLAG (SQUAREFLAG, pad))
> +    return SquarePadPoly (pad, pad->Thickness + pad->Clearance);
> +  else
> +    return LinePoly ((LineType *) pad, pad->Thickness + pad->Clearance);
> +}
> +
>  static int
>  SubtractPad (PadType * pad, PolygonType * p)
>  {
> @@ -852,18 +862,8 @@ SubtractPad (PadType * pad, PolygonType * p)
>  
>    if (pad->Clearance == 0)
>      return 0;
> -  if (TEST_FLAG (SQUAREFLAG, pad))
> -    {
> -      if (!
> -          (np = SquarePadPoly (pad, pad->Thickness + pad->Clearance)))
> -        return -1;
> -    }
> -  else
> -    {
> -      if (!
> -          (np = LinePoly ((LineType *) pad, pad->Thickness + pad->Clearance)))
> -        return -1;
> -    }
> +  if ((np = PadPoly (pad)) == NULL)
> +    return -1;
>    return Subtract (np, p, true);
>  }
>  
> @@ -922,7 +922,6 @@ pin_sub_callback (const BoxType * b, void *cl)
>  
>    poly_Boolean_free (info->accumulate, np, &merged, PBO_UNITE);
>    info->accumulate = merged;
> -
>    info->batch_size ++;
>  
>    if (info->batch_size == SUBTRACT_PIN_VIA_BATCH_SIZE)
> @@ -954,21 +953,28 @@ pad_sub_callback (const BoxType * b, void *cl)
>  {
>    PadType *pad = (PadType *) b;
>    struct cpInfo *info = (struct cpInfo *) cl;
> -  PolygonType *polygon;
> +  POLYAREA *np;
> +  POLYAREA *merged;
>  
>    /* don't subtract the object that was put back! */
>    if (b == info->other)
>      return 0;
>    if (pad->Clearance == 0)
>      return 0;
> -  polygon = info->polygon;
> -  if (XOR (TEST_FLAG (ONSOLDERFLAG, pad), !info->solder))
> -    {
> -      if (SubtractPad (pad, polygon) < 0)
> -        longjmp (info->env, 1);
> -      return 1;
> -    }
> -  return 0;
> +  if (!XOR (TEST_FLAG (ONSOLDERFLAG, pad), !info->solder))
> +    return 0;
> +
> +  if ((np = PadPoly (pad)) == NULL)
> +    longjmp (info->env, 1);
> +
> +  poly_Boolean_free (info->accumulate, np, &merged, PBO_UNITE);
> +  info->accumulate = merged;
> +  info->batch_size++;
> +
> +  if (info->batch_size == SUBTRACT_PAD_BATCH_SIZE)
> +    subtract_accumulated (info, info->polygon);
> +
> +  return 1;
>  }
>  
>  static int

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019