[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: pcb.git: branch: master updated (7186efa74e656913be2f7183baf5cbbc38f98d80)
The branch, master has been updated
via 7186efa74e656913be2f7183baf5cbbc38f98d80 (commit)
from 2682a6fdbae39859190e1527150464412e37c8eb (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/polygon.c | 49 +++++++++++++++++++++----------------------------
1 files changed, 21 insertions(+), 28 deletions(-)
=================
Commit Messages
=================
commit 7186efa74e656913be2f7183baf5cbbc38f98d80
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
Speed up unsubtraction from polygons when objects are deleted
This process worked by adding a new "blob" of polygon to cover in the
hole made by the object being deleted. If this "blob" intersected the
contour of the original polygon, it would cause the polygon's contour
to be damaged. To avoid this, the unsubract code would always clip the
resulting polygon against the original (pristine) polygon contour.
Unfortunately.. this clipping operation is gauranteed to intersect the
contour of the polygon - a very expensive operation, since all holes
inside the polygon (many on a complex board) have to be re-processed.
This speed-up is achieved by reversing the order of operation. The
"blob" to be added to the polygon is first clipped against the pristine
contour (a relatively cheap operation). This then allows us to add the
new clipped blob to the more complex polygon on the board without worry
that the contour may be compromised.
:100644 100644 6c34bc1... 4a4392f... M src/polygon.c
=========
Changes
=========
commit 7186efa74e656913be2f7183baf5cbbc38f98d80
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
Speed up unsubtraction from polygons when objects are deleted
This process worked by adding a new "blob" of polygon to cover in the
hole made by the object being deleted. If this "blob" intersected the
contour of the original polygon, it would cause the polygon's contour
to be damaged. To avoid this, the unsubract code would always clip the
resulting polygon against the original (pristine) polygon contour.
Unfortunately.. this clipping operation is gauranteed to intersect the
contour of the polygon - a very expensive operation, since all holes
inside the polygon (many on a complex board) have to be re-processed.
This speed-up is achieved by reversing the order of operation. The
"blob" to be added to the polygon is first clipped against the pristine
contour (a relatively cheap operation). This then allows us to add the
new clipped blob to the more complex polygon on the board without worry
that the contour may be compromised.
diff --git a/src/polygon.c b/src/polygon.c
index 6c34bc1..4a4392f 100644
--- a/src/polygon.c
+++ b/src/polygon.c
@@ -235,28 +235,6 @@ original_poly (PolygonType * p)
return biggest (np);
}
-static int
-ClipOriginal (PolygonType * poly)
-{
- POLYAREA *p, *result;
- int r;
-
- p = original_poly (poly);
- r = poly_Boolean_free (poly->Clipped, p, &result, PBO_ISECT);
- if (r != err_ok)
- {
- fprintf (stderr, "Error while clipping PBO_ISECT: %d\n", r);
- poly_Free (&result);
- poly->Clipped = NULL;
- if (poly->NoHoles) printf ("Just leaked in ClipOriginal\n");
- poly->NoHoles = NULL;
- return 0;
- }
- poly->Clipped = biggest (result);
- assert (!poly->Clipped || poly_Valid (poly->Clipped));
- return 1;
-}
-
POLYAREA *
RectPoly (LocationType x1, LocationType x2, LocationType y1, LocationType y2)
{
@@ -942,22 +920,37 @@ static int
Unsubtract (POLYAREA * np1, PolygonType * p)
{
POLYAREA *merged = NULL, *np = np1;
+ POLYAREA *orig_poly, *clipped_np;
int x;
assert (np);
assert (p && p->Clipped);
- x = poly_Boolean_free (p->Clipped, np, &merged, PBO_UNITE);
+
+ orig_poly = original_poly (p);
+
+ x = poly_Boolean_free (np, orig_poly, &clipped_np, PBO_ISECT);
+ if (x != err_ok)
+ {
+ fprintf (stderr, "Error while clipping PBO_ISECT: %d\n", x);
+ poly_Free (&clipped_np);
+ goto fail;
+ }
+
+ x = poly_Boolean_free (p->Clipped, clipped_np, &merged, PBO_UNITE);
if (x != err_ok)
{
fprintf (stderr, "Error while clipping PBO_UNITE: %d\n", x);
poly_Free (&merged);
- p->Clipped = NULL;
- if (p->NoHoles) printf ("Just leaked in Unsubtract\n");
- p->NoHoles = NULL;
- return 0;
+ goto fail;
}
p->Clipped = biggest (merged);
assert (!p->Clipped || poly_Valid (p->Clipped));
- return ClipOriginal (p);
+ return 1;
+
+fail:
+ p->Clipped = NULL;
+ if (p->NoHoles) printf ("Just leaked in Unsubtract\n");
+ p->NoHoles = NULL;
+ return 0;
}
static int
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs