[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: Strange PCB warning



On 11/11/09, Stefan Salewski <mail@xxxxxxxxxxxx> wrote:
> On Wed, 2009-11-11 at 20:21 +0100, Stefan Salewski wrote:
>> On Wed, 2009-11-11 at 19:09 +0100, michalwd1979 wrote:
>> http://www.ssalewski.de/tmp/t1.pcb
>>
>> Maybe related to your teardrops or area fill?
>>
>
> Reduced to
>
> http://www.ssalewski.de/tmp/t3.pcb
>
>
> Seems related to arc elements?

False alarm in ArcArcIntersect because the arcs have got intersecting
BoundingBoxes.

diff --git a/src/find.c b/src/find.c
index b24512a..46f2b3d 100644
--- a/src/find.c
+++ b/src/find.c
@@ -1327,6 +1327,24 @@ PVTouchesLine (LineTypePtr line)
   return (False);
 }

+static int
+radius_crosses_arc (float x, float y, ArcTypePtr arc)
+{
+  float alpha = atan2 (y - arc->Y, x - arc->X), start, delta;
+
+  start = (float) fmod (arc->StartAngle, 360);
+  delta = arc->Delta;
+  if (alpha < 0)
+    alpha += 360;
+  if (start < 0)
+    start += 360;
+  if (delta < 0)
+    {
+      start += delta;
+      delta = -delta;
+    }
+  return (start < alpha && start + delta > alpha);
+}
 /* ---------------------------------------------------------------------------
  * check if two arcs intersect
  * first we check for circle intersections,
@@ -1424,7 +1442,9 @@ ArcArcIntersect (ArcTypePtr Arc1, ArcTypePtr Arc2)
       && x + dy >= Arc2->BoundingBox.X1
       && x + dy <= Arc2->BoundingBox.X2
       && y - dx >= Arc2->BoundingBox.Y1 && y - dx <= Arc2->BoundingBox.Y2)
-    return (True);
+    if (radius_crosses_arc (x + dy, y - dx, Arc1)
+	&& radius_crosses_arc (x + dy, y - dx, Arc2))
+      return (True);

   if (x - dy >= Arc1->BoundingBox.X1
       && x - dy <= Arc1->BoundingBox.X2
@@ -1433,7 +1453,9 @@ ArcArcIntersect (ArcTypePtr Arc1, ArcTypePtr Arc2)
       && x - dy >= Arc2->BoundingBox.X1
       && x - dy <= Arc2->BoundingBox.X2
       && y + dx >= Arc2->BoundingBox.Y1 && y + dx <= Arc2->BoundingBox.Y2)
-    return (True);
+    if (radius_crosses_arc (x - dy, y + dx, Arc1)
+	&& radius_crosses_arc (x - dy, y + dx, Arc2))
+      return (True);

   /* try the end points in case the ends don't actually pierce the
outer radii */
   box = GetArcEnds (Arc1);

Thanks,
Ineiev


_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user