[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: pcb.git: branch: master updated (e9f45c42af6fa5770186f44fb6be8a60f061dc93)
The branch, master has been updated
via e9f45c42af6fa5770186f44fb6be8a60f061dc93 (commit)
via 1afc64a8f6d929e7c40c75032efcaa58334bfcb2 (commit)
from 9768e060fad7bc3dfc366da76ea1db8154005018 (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/misc.c | 117 ++++++++++++++++++++++++++------------------------------
src/parse_y.y | 2 -
2 files changed, 54 insertions(+), 65 deletions(-)
=================
Commit Messages
=================
commit e9f45c42af6fa5770186f44fb6be8a60f061dc93
Author: DJ Delorie <dj@xxxxxxxxxxx>
Commit: DJ Delorie <dj@xxxxxxxxxxx>
Fix arc bounding box math.
Calculations for Arc bounding boxes weren't taking into account
the wide range of possible starting arcs. This patch uses modulus
to force angles into canonical forms and iterates through quadrants
to capture the full extents of each arc.
:100644 100644 5599d82... 34d103c... M src/misc.c
commit 1afc64a8f6d929e7c40c75032efcaa58334bfcb2
Author: DJ Delorie <dj@xxxxxxxxxxx>
Commit: DJ Delorie <dj@xxxxxxxxxxx>
Fix typo in parse_y.y
A typo in parse_y.y was causing the documentation to be corrupted.
:100644 100644 a5b2d23... f4fc367... M src/parse_y.y
=========
Changes
=========
commit e9f45c42af6fa5770186f44fb6be8a60f061dc93
Author: DJ Delorie <dj@xxxxxxxxxxx>
Commit: DJ Delorie <dj@xxxxxxxxxxx>
Fix arc bounding box math.
Calculations for Arc bounding boxes weren't taking into account
the wide range of possible starting arcs. This patch uses modulus
to force angles into canonical forms and iterates through quadrants
to capture the full extents of each arc.
diff --git a/src/misc.c b/src/misc.c
index 5599d82..34d103c 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -1255,85 +1255,76 @@ void
SetArcBoundingBox (ArcTypePtr Arc)
{
register double ca1, ca2, sa1, sa2;
- register LocationType ang1, ang2;
+ double minx, maxx, miny, maxy;
+ register LocationType ang1, ang2, delta, a;
register LocationType width;
/* first put angles into standard form */
if (Arc->Delta > 360)
Arc->Delta = 360;
- ang1 = Arc->StartAngle;
- ang2 = Arc->StartAngle + Arc->Delta;
- if (Arc->Delta < 0)
+ if (Arc->Delta < -360)
+ Arc->Delta = -360;
+
+ if (Arc->Delta > 0)
{
- LocationType temp;
- temp = ang1;
- ang1 = ang2;
- ang2 = temp;
+ ang1 = Arc->StartAngle;
+ delta = Arc->Delta;
}
- if (ang1 < 0)
+ else
{
- ang1 += 360;
- ang2 += 360;
+ ang1 = Arc->StartAngle + Arc->Delta;
+ delta = -Arc->Delta;
}
+ if (ang1 < 0)
+ ang1 = 360 - ((-ang1) % 360);
+ else
+ ang1 = ang1 % 360;
+
+ ang2 = ang1 + delta;
+
/* calculate sines, cosines */
- switch (ang1)
- {
- case 0:
- ca1 = 1.0;
- sa1 = 0;
- break;
- case 90:
- ca1 = 0;
- sa1 = 1.0;
- break;
- case 180:
- ca1 = -1.0;
- sa1 = 0;
- break;
- case 270:
- ca1 = 0;
- sa1 = -1.0;
- break;
- default:
- ca1 = M180 * (double) ang1;
- sa1 = sin (ca1);
- ca1 = cos (ca1);
- }
- switch (ang2)
+ ca1 = M180 * (double) ang1;
+ sa1 = sin (ca1);
+ ca1 = cos (ca1);
+
+ minx = maxx = ca1;
+ miny = maxy = sa1;
+
+ ca2 = M180 * (double) ang2;
+ sa2 = sin (ca2);
+ ca2 = cos (ca2);
+
+ minx = MIN (minx, ca2);
+ maxx = MAX (maxx, ca2);
+ miny = MIN (miny, sa2);
+ maxy = MAX (maxy, sa2);
+
+ for (a = ang1 - ang1 % 90 + 90; a < ang2; a += 90)
{
- case 0:
- ca2 = 1.0;
- sa2 = 0;
- break;
- case 90:
- ca2 = 0;
- sa2 = 1.0;
- break;
- case 180:
- ca2 = -1.0;
- sa2 = 0;
- break;
- case 270:
- ca2 = 0;
- sa2 = -1.0;
- break;
- default:
- ca2 = M180 * (double) ang2;
- sa2 = sin (ca2);
- ca2 = cos (ca2);
+ switch (a % 360)
+ {
+ case 0:
+ maxx = 1;
+ break;
+ case 90:
+ maxy = 1;
+ break;
+ case 180:
+ minx = -1;
+ break;
+ case 270:
+ miny = -1;
+ break;
+ }
}
- Arc->BoundingBox.X2 = Arc->X - Arc->Width *
- ((ang1 < 180 && ang2 > 180) ? -1 : MIN (ca1, ca2));
+ Arc->BoundingBox.X2 = Arc->X - Arc->Width * minx;
- Arc->BoundingBox.X1 = Arc->X - Arc->Width *
- ((ang1 < 360 && ang2 > 360) ? 1 : MAX (ca1, ca2));
+ Arc->BoundingBox.X1 = Arc->X - Arc->Width * maxx;
- Arc->BoundingBox.Y2 = Arc->Y + Arc->Height *
- ((ang1 < 90 && ang2 > 90) ? 1 : MAX (sa1, sa2));
+ Arc->BoundingBox.Y2 = Arc->Y + Arc->Height * maxy;
- Arc->BoundingBox.Y1 = Arc->Y + Arc->Height *
- ((ang1 < 270 && ang2 > 270) ? -1 : MIN (sa1, sa2));
+ Arc->BoundingBox.Y1 = Arc->Y + Arc->Height * miny;
width = (Arc->Thickness + Arc->Clearance) / 2;
Arc->BoundingBox.X1 -= width;
commit 1afc64a8f6d929e7c40c75032efcaa58334bfcb2
Author: DJ Delorie <dj@xxxxxxxxxxx>
Commit: DJ Delorie <dj@xxxxxxxxxxx>
Fix typo in parse_y.y
A typo in parse_y.y was causing the documentation to be corrupted.
diff --git a/src/parse_y.y b/src/parse_y.y
index a5b2d23..f4fc367 100644
--- a/src/parse_y.y
+++ b/src/parse_y.y
@@ -278,8 +278,6 @@ T_FILEVERSION '[' NUMBER ']'
}
;
-/* %start-doc pcbfile Grid
-
/* %start-doc pcbfile PCB
@syntax
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs