[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: pcb.git: branch: master updated (b3903db46402e65d6f26a18857e818bb7acec428)
The branch, master has been updated
via b3903db46402e65d6f26a18857e818bb7acec428 (commit)
from ff33014dc2514203e5c63a055c1e09828d00876a (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
=========
Summary
=========
src/find.c | 70 ++++++++++++++++++++++++++++++-----------------------------
1 files changed, 36 insertions(+), 34 deletions(-)
=================
Commit Messages
=================
commit b3903db46402e65d6f26a18857e818bb7acec428
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
Tidy up IsPolygonInPolygon
No functional changes
:100644 100644 97424ce... e22d5cc... M src/find.c
=========
Changes
=========
commit b3903db46402e65d6f26a18857e818bb7acec428
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
Tidy up IsPolygonInPolygon
No functional changes
diff --git a/src/find.c b/src/find.c
index 97424ce..e22d5cc 100644
--- a/src/find.c
+++ b/src/find.c
@@ -2644,49 +2644,51 @@ IsPolygonInPolygon (PolygonTypePtr P1, PolygonTypePtr P2)
return False;
assert (P1->Clipped->contours);
assert (P2->Clipped->contours);
- /* first check if both bounding boxes intersect */
- if (P1->Clipped->contours->xmin - Bloat <= P2->Clipped->contours->xmax &&
- P1->Clipped->contours->xmax + Bloat >= P2->Clipped->contours->xmin &&
- P1->Clipped->contours->ymin - Bloat <= P2->Clipped->contours->ymax &&
- P1->Clipped->contours->ymax + Bloat >= P2->Clipped->contours->ymin)
+
+ /* first check if both bounding boxes intersect. If not, return quickly */
+ if (P1->Clipped->contours->xmin - Bloat > P2->Clipped->contours->xmax ||
+ P1->Clipped->contours->xmax + Bloat < P2->Clipped->contours->xmin ||
+ P1->Clipped->contours->ymin - Bloat > P2->Clipped->contours->ymax ||
+ P1->Clipped->contours->ymax + Bloat < P2->Clipped->contours->ymin)
+ return False;
+
+ /* first check un-bloated case */
+ if (isects (P1->Clipped, P2, False))
+ return TRUE;
+
+ /* now the difficult case of bloated */
+ if (Bloat > 0)
{
PLINE *c;
-
- /* first check un-bloated case */
- if (isects (P1->Clipped, P2, False))
- return TRUE;
- if (Bloat > 0)
+ for (c = P1->Clipped->contours; c; c = c->next)
{
- /* now the difficult case of bloated */
- for (c = P1->Clipped->contours; c; c = c->next)
+ LineType line;
+ VNODE *v = &c->head;
+ if (c->xmin - Bloat <= P2->Clipped->contours->xmax &&
+ c->xmax + Bloat >= P2->Clipped->contours->xmin &&
+ c->ymin - Bloat <= P2->Clipped->contours->ymax &&
+ c->ymax + Bloat >= P2->Clipped->contours->ymin)
{
- LineType line;
- VNODE *v = &c->head;
- if (c->xmin - Bloat <= P2->Clipped->contours->xmax &&
- c->xmax + Bloat >= P2->Clipped->contours->xmin &&
- c->ymin - Bloat <= P2->Clipped->contours->ymax &&
- c->ymax + Bloat >= P2->Clipped->contours->ymin)
- {
- line.Point1.X = v->point[0];
- line.Point1.Y = v->point[1];
- line.Thickness = 2 * Bloat;
- line.Clearance = 0;
- line.Flags = NoFlags ();
- for (v = v->next; v != &c->head; v = v->next)
- {
- line.Point2.X = v->point[0];
- line.Point2.Y = v->point[1];
- SetLineBoundingBox (&line);
- if (IsLineInPolygon (&line, P2))
- return (True);
- line.Point1.X = line.Point2.X;
- line.Point1.Y = line.Point2.Y;
- }
+ line.Point1.X = v->point[0];
+ line.Point1.Y = v->point[1];
+ line.Thickness = 2 * Bloat;
+ line.Clearance = 0;
+ line.Flags = NoFlags ();
+ for (v = v->next; v != &c->head; v = v->next)
+ {
+ line.Point2.X = v->point[0];
+ line.Point2.Y = v->point[1];
+ SetLineBoundingBox (&line);
+ if (IsLineInPolygon (&line, P2))
+ return (True);
+ line.Point1.X = line.Point2.X;
+ line.Point1.Y = line.Point2.Y;
}
}
}
}
+
return (False);
}
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs