[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: pcb.git: branch: master updated (d2288a4491f5f6b592cd5a57835e178c08e72e10)
The branch, master has been updated
via d2288a4491f5f6b592cd5a57835e178c08e72e10 (commit)
via 445c76b23bbe3c04c5eea6801169862803ff01c7 (commit)
via 05686e3bdb2d81d414386a1a97cc566d5c66a8de (commit)
via f231ddf4ebb4709c7e911f85bb9242f780e313d4 (commit)
via f10bed446e6052a4876ed11619bd4860f71c2aeb (commit)
via 570bb6cb0017ed5fbe4068ce2037568b06857265 (commit)
via 9aa2725edcc0ceb6c1c3a602cc4e0adfc83f3737 (commit)
via f4afb96a8b3fba437164c70855d635226ff8fd58 (commit)
via 657e9a7fe077a659f4017984bb7a63184382b229 (commit)
via dcfd8bd1b26d91ef3a001f00faa0ff915a3e18c6 (commit)
via cf69668a784b2ed11d033a0accc96403cf1a01b0 (commit)
via cb4bd2d1a21c042aaa89343acf96b52290bc2cd3 (commit)
via 1a6a473a21f150139a383b6fa39e8865ceb5f02d (commit)
via 421c487a1adc5f93a5d1ef2b7a0085750b161b0a (commit)
via e873882e2465a74ef2c1b9cab54ed12dc170856e (commit)
via 592a836a66f7ebdef6d72b1f79c21ddb5289a26e (commit)
via c4ffceda456e150f036c05c28ddf15d9782eacdd (commit)
via 6027180567c13bb4d3ad1000ed8c966c5d8c7a55 (commit)
via ccc611da9065af30552e0774709584f49a4eba6c (commit)
via e0c189a781e127c750243dbb4172d4778a6850fd (commit)
via 296506b9a68ec4fcf01e455cd1734772adcf154e (commit)
via 02f0d48542c2d322c377ab3f353667cbcb81928c (commit)
from ade3ba088e79f52dc9e44fb529276e14b3f08d62 (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/toporouter.c | 679 +++++++++++++++---------------------------------------
src/toporouter.h | 6 +-
2 files changed, 185 insertions(+), 500 deletions(-)
=================
Commit Messages
=================
commit d2288a4491f5f6b592cd5a57835e178c08e72e10
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Convert some debugging constants to COORD units properly
(Broken since we switched to nanometers)
:100644 100644 7e58cae... d31c788... M src/toporouter.c
commit 445c76b23bbe3c04c5eea6801169862803ff01c7
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Fix print of time taken by the toporouter
The old code conflated microseconds, milliseconds and was generally nuts.
:100644 100644 226a70b... 7e58cae... M src/toporouter.c
commit 05686e3bdb2d81d414386a1a97cc566d5c66a8de
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Remove unused, commented print_trace() function
:100644 100644 80fe5e2... 226a70b... M src/toporouter.c
commit f231ddf4ebb4709c7e911f85bb9242f780e313d4
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Remove unused (toporouter_t *)->stublength
:100644 100644 d3ebd4e... 80fe5e2... M src/toporouter.c
:100644 100644 667aeeb... f014332... M src/toporouter.h
commit f10bed446e6052a4876ed11619bd4860f71c2aeb
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Remove unused (toporouter_t *)->viamax
:100644 100644 a440fa1... d3ebd4e... M src/toporouter.c
:100644 100644 43b2824... 667aeeb... M src/toporouter.h
commit 570bb6cb0017ed5fbe4068ce2037568b06857265
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Remove unused (toporouter_t *)->serpintine_half_amplitude
:100644 100644 9627562... a440fa1... M src/toporouter.c
:100644 100644 9e8a67d... 43b2824... M src/toporouter.h
commit 9aa2725edcc0ceb6c1c3a602cc4e0adfc83f3737
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Re-write {coord,point}_intersect_prop() to increase clariry.
Since the wind_* values computed in this function can be -1, 0 or 1,
it is clearer to test them using equality relations, not perform XOR
operations on their bit-patterns.
I believe the old code worked, but it would return an strange constant
for "true". To ram the point home, I've changed the function to return
bool.
:100644 100644 ac9d2e7... 9627562... M src/toporouter.c
commit f4afb96a8b3fba437164c70855d635226ff8fd58
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Remove commented tvertex_intersect() function
The implementation being used is a macro in toporouter.h
:100644 100644 bc2025e... ac9d2e7... M src/toporouter.c
commit 657e9a7fe077a659f4017984bb7a63184382b229
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Remove unused function tvertex_intersect_prop()
:100644 100644 9b3d548... bc2025e... M src/toporouter.c
commit dcfd8bd1b26d91ef3a001f00faa0ff915a3e18c6
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Re-arrange the maths in {vertices,coords}_on_line()
Should given an identical result, but with a couple fewer operations.
:100644 100644 dd028d5... 9b3d548... M src/toporouter.c
commit cf69668a784b2ed11d033a0accc96403cf1a01b0
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Remove unused function points_on_line()
:100644 100644 2ce5175... dd028d5... M src/toporouter.c
commit cb4bd2d1a21c042aaa89343acf96b52290bc2cd3
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Remove unused wind_double() function
:100644 100644 000da7b... 2ce5175... M src/toporouter.c
commit 1a6a473a21f150139a383b6fa39e8865ceb5f02d
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Remove unused sloppy_.*wind() functions
:100644 100644 609a53d... 000da7b... M src/toporouter.c
commit 421c487a1adc5f93a5d1ef2b7a0085750b161b0a
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter: Re-implement functions using atan with atan2
Simplifies and condenses the code a lot.
:100644 100644 c186d4a... 609a53d... M src/toporouter.c
commit e873882e2465a74ef2c1b9cab54ed12dc170856e
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Replace coord_xangle() with coord_angle()
The new function returning the "normal" coordinate system angle one would
expect. Replace usage of coord_xangle() in export_pcb_drawarc() with the
new function.
PCB's arc angles are a bit nutty, so lets try to contain that strangeness
to the arc exporting routine!
:100644 100644 ab1338c... c186d4a... M src/toporouter.c
commit 592a836a66f7ebdef6d72b1f79c21ddb5289a26e
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Remove unused point_xangle() function
(Unused since the previous commit)
:100644 100644 51c8de6... ab1338c... M src/toporouter.c
commit c4ffceda456e150f036c05c28ddf15d9782eacdd
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Remove unused region_span() function
:100644 100644 7fdd79d... 51c8de6... M src/toporouter.c
commit 6027180567c13bb4d3ad1000ed8c966c5d8c7a55
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter: Remove unused vertex_move_towards_point[_values]() functions
:100644 100644 fecc4d5... 7fdd79d... M src/toporouter.c
commit ccc611da9065af30552e0774709584f49a4eba6c
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Fix constants which assumed CMIL for PCB's internal units
This should make the toporouter work again.
:100644 100644 73e3990... fecc4d5... M src/toporouter.c
commit e0c189a781e127c750243dbb4172d4778a6850fd
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Fixup and clean read_board_constraints() and create_board_edge()
Introduce a #defined constant which expresses how fine to break the board
edges into (the old hard-coded constant was broken since we changed to
nanometers).
:100644 100644 734c733... 73e3990... M src/toporouter.c
commit 296506b9a68ec4fcf01e455cd1734772adcf154e
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporoute.c: Remove runtime Copyright message from toporouter
Not only is Anthony now not the only author of this code, we don't do
this for anything else.. why should we for this. It could potentially act
to discorage others from working on this code, and we don't want that.
:100644 100644 bff1e7a... 734c733... M src/toporouter.c
commit 02f0d48542c2d322c377ab3f353667cbcb81928c
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.[ch]: Add generic "contributors" copyright notice
"Copyright (C) 2009-2011 PCB Contibrutors (See ChangeLog for details)"
:100644 100644 e5310b0... bff1e7a... M src/toporouter.c
:100644 100644 fcd0053... 9e8a67d... M src/toporouter.h
=========
Changes
=========
commit d2288a4491f5f6b592cd5a57835e178c08e72e10
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Convert some debugging constants to COORD units properly
(Broken since we switched to nanometers)
diff --git a/src/toporouter.c b/src/toporouter.c
index 7e58cae..d31c788 100644
--- a/src/toporouter.c
+++ b/src/toporouter.c
@@ -6462,8 +6462,11 @@ oproute_rubberband(toporouter_t *r, GList *path)
oproute_path_speccut(oproute);
#ifdef DEBUG_RUBBERBAND
- if(!strcmp(oproute->netlist, " VCC3V3") && vx(oproute->term1) == 95700. && vy(oproute->term1) == 70800. &&
- vx(oproute->term2) == 196700. && vy(oproute->term2) == 67300.)
+ if(strcmp(oproute->netlist, " VCC3V3" == 0) &&
+ vx(oproute->term1) == MIL_TO_COORD (957.) &&
+ vy(oproute->term1) == MIL_TO_COORD (708.) &&
+ vx(oproute->term2) == MIL_TO_COORD (1967.) &&
+ vy(oproute->term2) == MIL_TO_COORD (673.))
{
// printf("OPROUTE %s - %f,%f %f,%f\n", oproute->netlist, vx(oproute->term1), vy(oproute->term1), vx(oproute->term2), vy(oproute->term2));
// print_path(path);
commit 445c76b23bbe3c04c5eea6801169862803ff01c7
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Fix print of time taken by the toporouter
The old code conflated microseconds, milliseconds and was generally nuts.
diff --git a/src/toporouter.c b/src/toporouter.c
index 226a70b..7e58cae 100644
--- a/src/toporouter.c
+++ b/src/toporouter.c
@@ -1106,26 +1106,19 @@ groupcount(void)
void
toporouter_free(toporouter_t *r)
{
- struct timeval endtime;
- int secs, usecs;
+ struct timeval endtime;
+ double time_delta;
int i;
for(i=0;i<groupcount();i++) {
toporouter_layer_free(&r->layers[i]);
}
+ gettimeofday (&endtime, NULL);
+ time_delta = endtime.tv_sec - r->starttime.tv_sec +
+ (endtime.tv_usec - r->starttime.tv_usec) / 1000000.;
- gettimeofday(&endtime, NULL);
-
- secs = (int)(endtime.tv_sec - r->starttime.tv_sec);
- usecs = (int)((endtime.tv_usec - r->starttime.tv_usec) / 1000);
-
- if(usecs < 0) {
- secs -= 1;
- usecs += 1000;
- }
-
- Message(_("Elapsed time: %d.%02d seconds\n"), secs, usecs);
+ Message(_("Elapsed time: %.2f seconds\n"), time_delta);
free(r->layers);
free(r);
commit 05686e3bdb2d81d414386a1a97cc566d5c66a8de
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Remove unused, commented print_trace() function
diff --git a/src/toporouter.c b/src/toporouter.c
index 80fe5e2..226a70b 100644
--- a/src/toporouter.c
+++ b/src/toporouter.c
@@ -703,26 +703,6 @@ vertex_net_keepaway(toporouter_vertex_t *v)
if(!box || !box->cluster) return Settings.Keepaway;
return cluster_keepaway(box->cluster);
}
-/*
-void
-print_trace (void)
-{
- void *array[10];
- size_t size;
- char **strings;
- size_t i;
-
- size = backtrace (array, 10);
- strings = backtrace_symbols (array, size);
-
- printf ("Obtained %zd stack frames.\n", size);
-
- for (i = 0; i < size; i++)
- printf ("%s\n", strings[i]);
-
- free (strings);
-}
-*/
/* fills in x and y with coordinates of point from a towards b of distance d */
static void
commit f231ddf4ebb4709c7e911f85bb9242f780e313d4
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Remove unused (toporouter_t *)->stublength
diff --git a/src/toporouter.c b/src/toporouter.c
index d3ebd4e..80fe5e2 100644
--- a/src/toporouter.c
+++ b/src/toporouter.c
@@ -7577,7 +7577,6 @@ toporouter_new(void)
r->layers = NULL;
r->flags = 0;
r->viacost = VIA_COST_AS_DISTANCE;
- r->stublength = 300.;
r->wiring_score = 0.;
diff --git a/src/toporouter.h b/src/toporouter.h
index 667aeeb..f014332 100644
--- a/src/toporouter.h
+++ b/src/toporouter.h
@@ -420,7 +420,6 @@ struct _toporouter_t {
/* settings: */
gdouble viacost;
- gdouble stublength;
gdouble wiring_score;
commit f10bed446e6052a4876ed11619bd4860f71c2aeb
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Remove unused (toporouter_t *)->viamax
diff --git a/src/toporouter.c b/src/toporouter.c
index a440fa1..d3ebd4e 100644
--- a/src/toporouter.c
+++ b/src/toporouter.c
@@ -7576,7 +7576,6 @@ toporouter_new(void)
r->layers = NULL;
r->flags = 0;
- r->viamax = 3;
r->viacost = VIA_COST_AS_DISTANCE;
r->stublength = 300.;
diff --git a/src/toporouter.h b/src/toporouter.h
index 43b2824..667aeeb 100644
--- a/src/toporouter.h
+++ b/src/toporouter.h
@@ -419,7 +419,6 @@ struct _toporouter_t {
GList *destboxes, *consumeddestboxes;
/* settings: */
- guint viamax;
gdouble viacost;
gdouble stublength;
commit 570bb6cb0017ed5fbe4068ce2037568b06857265
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Remove unused (toporouter_t *)->serpintine_half_amplitude
diff --git a/src/toporouter.c b/src/toporouter.c
index 9627562..a440fa1 100644
--- a/src/toporouter.c
+++ b/src/toporouter.c
@@ -7579,7 +7579,6 @@ toporouter_new(void)
r->viamax = 3;
r->viacost = VIA_COST_AS_DISTANCE;
r->stublength = 300.;
- r->serpintine_half_amplitude = 1500.;
r->wiring_score = 0.;
diff --git a/src/toporouter.h b/src/toporouter.h
index 9e8a67d..43b2824 100644
--- a/src/toporouter.h
+++ b/src/toporouter.h
@@ -422,7 +422,6 @@ struct _toporouter_t {
guint viamax;
gdouble viacost;
gdouble stublength;
- gdouble serpintine_half_amplitude;
gdouble wiring_score;
commit 9aa2725edcc0ceb6c1c3a602cc4e0adfc83f3737
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Re-write {coord,point}_intersect_prop() to increase clariry.
Since the wind_* values computed in this function can be -1, 0 or 1,
it is clearer to test them using equality relations, not perform XOR
operations on their bit-patterns.
I believe the old code worked, but it would return an strange constant
for "true". To ram the point home, I've changed the function to return
bool.
diff --git a/src/toporouter.c b/src/toporouter.c
index ac9d2e7..9627562 100644
--- a/src/toporouter.c
+++ b/src/toporouter.c
@@ -1338,34 +1338,41 @@ vertex_outside_segment(toporouter_spoint_t *a, toporouter_spoint_t *b, gdouble r
* AB and CD must share a point interior to both segments.
* returns TRUE if AB properly intersects CD.
*/
-gint
-coord_intersect_prop(gdouble ax, gdouble ay, gdouble bx, gdouble by, gdouble cx, gdouble cy, gdouble dx, gdouble dy)
+static bool
+coord_intersect_prop (double ax, double ay,
+ double bx, double by,
+ double cx, double cy,
+ double dx, double dy)
{
- gint wind_abc = coord_wind(ax, ay, bx, by, cx, cy);
- gint wind_abd = coord_wind(ax, ay, bx, by, dx, dy);
- gint wind_cda = coord_wind(cx, cy, dx, dy, ax, ay);
- gint wind_cdb = coord_wind(cx, cy, dx, dy, bx, by);
+ int wind_abc = coord_wind (ax, ay, bx, by, cx, cy);
+ int wind_abd = coord_wind (ax, ay, bx, by, dx, dy);
+ int wind_cda = coord_wind (cx, cy, dx, dy, ax, ay);
+ int wind_cdb = coord_wind (cx, cy, dx, dy, bx, by);
- if( !wind_abc || !wind_abd || !wind_cda || !wind_cdb ) return 0;
+ /* If any of the line end-points are colinear with the other line, return false */
+ if (wind_abc == 0 || wind_abd == 0 || wind_cda == 0 || wind_cdb == 0)
+ return false;
- return ( wind_abc ^ wind_abd ) && ( wind_cda ^ wind_cdb );
+ return (wind_abc != wind_abd) && (wind_cda != wind_cdb);
}
/* proper intersection:
* AB and CD must share a point interior to both segments.
* returns TRUE if AB properly intersects CD.
*/
-int
-point_intersect_prop(GtsPoint *a, GtsPoint *b, GtsPoint *c, GtsPoint *d)
+static bool
+point_intersect_prop (GtsPoint *a, GtsPoint *b, GtsPoint *c, GtsPoint *d)
{
+ int wind_abc = point_wind (a, b, c);
+ int wind_abd = point_wind (a, b, d);
+ int wind_cda = point_wind (c, d, a);
+ int wind_cdb = point_wind (c, d, b);
- if( point_wind(a, b, c) == 0 ||
- point_wind(a, b, d) == 0 ||
- point_wind(c, d, a) == 0 ||
- point_wind(c, d, b) == 0 ) return 0;
+ /* If any of the line end-points are colinear with the other line, return false */
+ if (wind_abc == 0 || wind_abd == 0 || wind_cda == 0 || wind_cdb == 0)
+ return false;
- return ( point_wind(a, b, c) ^ point_wind(a, b, d) ) &&
- ( point_wind(c, d, a) ^ point_wind(c, d, b) );
+ return (wind_abc != wind_abd) && (wind_cda != wind_cdb);
}
static inline int
commit f4afb96a8b3fba437164c70855d635226ff8fd58
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Remove commented tvertex_intersect() function
The implementation being used is a macro in toporouter.h
diff --git a/src/toporouter.c b/src/toporouter.c
index bc2025e..ac9d2e7 100644
--- a/src/toporouter.c
+++ b/src/toporouter.c
@@ -1374,18 +1374,6 @@ vertex_intersect_prop(GtsVertex *a, GtsVertex *b, GtsVertex *c, GtsVertex *d)
return point_intersect_prop(GTS_POINT(a), GTS_POINT(b), GTS_POINT(c), GTS_POINT(d));
}
-/*
-static inline int
-tvertex_intersect(toporouter_vertex_t *a, toporouter_vertex_t *b, toporouter_vertex_t *c, toporouter_vertex_t *d)
-{
- if( !point_wind(GTS_POINT(a), GTS_POINT(d), GTS_POINT(b)) || !point_wind(GTS_POINT(a), GTS_POINT(c), GTS_POINT(b)) ) return 1;
-
- return
- ( point_wind(GTS_POINT(a), GTS_POINT(b), GTS_POINT(c)) ^ point_wind(GTS_POINT(a), GTS_POINT(b), GTS_POINT(d)) ) &&
- ( point_wind(GTS_POINT(c), GTS_POINT(d), GTS_POINT(a)) ^ point_wind(GTS_POINT(c), GTS_POINT(d), GTS_POINT(b)) );
-}
-*/
-
/* intersection vertex:
* AB and CD must share a point interior to both segments.
* returns vertex at intersection of AB and CD.
commit 657e9a7fe077a659f4017984bb7a63184382b229
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Remove unused function tvertex_intersect_prop()
diff --git a/src/toporouter.c b/src/toporouter.c
index 9b3d548..bc2025e 100644
--- a/src/toporouter.c
+++ b/src/toporouter.c
@@ -1374,11 +1374,6 @@ vertex_intersect_prop(GtsVertex *a, GtsVertex *b, GtsVertex *c, GtsVertex *d)
return point_intersect_prop(GTS_POINT(a), GTS_POINT(b), GTS_POINT(c), GTS_POINT(d));
}
-static inline int
-tvertex_intersect_prop(toporouter_vertex_t *a, toporouter_vertex_t *b, toporouter_vertex_t *c, toporouter_vertex_t *d)
-{
- return point_intersect_prop(GTS_POINT(a), GTS_POINT(b), GTS_POINT(c), GTS_POINT(d));
-}
/*
static inline int
tvertex_intersect(toporouter_vertex_t *a, toporouter_vertex_t *b, toporouter_vertex_t *c, toporouter_vertex_t *d)
commit dcfd8bd1b26d91ef3a001f00faa0ff915a3e18c6
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Re-arrange the maths in {vertices,coords}_on_line()
Should given an identical result, but with a couple fewer operations.
diff --git a/src/toporouter.c b/src/toporouter.c
index dd028d5..9b3d548 100644
--- a/src/toporouter.c
+++ b/src/toporouter.c
@@ -1183,70 +1183,75 @@ print_toporouter_vertex(toporouter_vertex_t *tv)
/**
* vertices_on_line:
- * Given vertex a, gradient m, and radius r:
+ * Given vertex a, gradient m, and radius r:
*
* Return vertices on line of a & m at r from a
*/
-void
-vertices_on_line(toporouter_spoint_t *a, gdouble m, gdouble r, toporouter_spoint_t *b0, toporouter_spoint_t *b1)
+static void
+vertices_on_line (toporouter_spoint_t *a,
+ double m,
+ double r,
+ toporouter_spoint_t *b0,
+ toporouter_spoint_t *b1)
{
- gdouble c, temp;
-
- if(m == INFINITY || m == -INFINITY) {
- b0->y = a->y + r;
- b1->y = a->y - r;
+ double c, dx;
+
+ if (m == INFINITY || m == -INFINITY) {
b0->x = a->x;
+ b0->y = a->y + r;
+
b1->x = a->x;
-
+ b1->y = a->y - r;
+
return;
}
- c = a->y - (m * a->x);
+ c = a->y - m * a->x;
+ dx = r / sqrt (1 + pow (m, 2));
- temp = sqrt( pow(r, 2) / ( 1 + pow(m, 2) ) );
-
- b0->x = a->x + temp;
- b1->x = a->x - temp;
-
- b0->y = b0->x * m + c;
- b1->y = b1->x * m + c;
+ b0->x = a->x + dx;
+ b0->y = m * b0->x + c;
+ b1->x = a->x - dx;
+ b1->y = m * b1->x + c;
}
/**
- * vertices_on_line:
- * Given vertex a, gradient m, and radius r:
+ * coords_on_line:
+ * Given coordinates ax, ay, gradient m, and radius r:
*
- * Return vertices on line of a & m at r from a
- */
-void
-coords_on_line(gdouble ax, gdouble ay, gdouble m, gdouble r, gdouble *b0x, gdouble *b0y, gdouble *b1x, gdouble *b1y)
+ * Return coordinates on line of a & m at r from a
+ */
+static void
+coords_on_line (double ax, gdouble ay,
+ double m,
+ double r,
+ double *b0x, double *b0y,
+ double *b1x, double *b1y)
{
+ double c, dx;
- gdouble c, temp;
-
- if(m == INFINITY || m == -INFINITY) {
- *b0y = ay + r;
- *b1y = ay - r;
+ if (m == INFINITY || m == -INFINITY) {
*b0x = ax;
+ *b0y = ay + r;
+
*b1x = ax;
-
+ *b1y = ay - r;
+
return;
}
- c = ay - (m * ax);
-
- temp = sqrt( pow(r, 2) / ( 1 + pow(m, 2) ) );
+ c = ay - m * ax;
+ dx = r / sqrt (1 + pow (m, 2));
- *b0x = ax + temp;
- *b1x = ax - temp;
-
- *b0y = *b0x * m + c;
- *b1y = *b1x * m + c;
+ *b0x = ax + dx;
+ *b0y = m * *b0x + c;
+ *b1x = ax - dx;
+ *b1y = m * *b1x + c;
}
/*
commit cf69668a784b2ed11d033a0accc96403cf1a01b0
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Remove unused function points_on_line()
diff --git a/src/toporouter.c b/src/toporouter.c
index 2ce5175..dd028d5 100644
--- a/src/toporouter.c
+++ b/src/toporouter.c
@@ -1249,40 +1249,6 @@ coords_on_line(gdouble ax, gdouble ay, gdouble m, gdouble r, gdouble *b0x, gdoub
}
-/**
- * vertices_on_line:
- * Given vertex a, gradient m, and radius r:
- *
- * Return vertices on line of a & m at r from a
- */
-void
-points_on_line(GtsPoint *a, gdouble m, gdouble r, GtsPoint *b0, GtsPoint *b1)
-{
-
- gdouble c, temp;
-
- if(m == INFINITY || m == -INFINITY) {
- b0->y = a->y + r;
- b1->y = a->y - r;
-
- b0->x = a->x;
- b1->x = a->x;
-
- return;
- }
-
- c = a->y - (m * a->x);
-
- temp = sqrt( pow(r, 2) / ( 1 + pow(m, 2) ) );
-
- b0->x = a->x + temp;
- b1->x = a->x - temp;
-
- b0->y = b0->x * m + c;
- b1->y = b1->x * m + c;
-
-}
-
/*
* Returns gradient of segment given by a & b
*/
commit cb4bd2d1a21c042aaa89343acf96b52290bc2cd3
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Remove unused wind_double() function
diff --git a/src/toporouter.c b/src/toporouter.c
index 000da7b..2ce5175 100644
--- a/src/toporouter.c
+++ b/src/toporouter.c
@@ -1164,19 +1164,6 @@ wind(toporouter_spoint_t *p1, toporouter_spoint_t *p2, toporouter_spoint_t *p3)
return (rval > 0.0001) ? 1 : ((rval < -0.0001) ? -1 : 0); /* XXX: Depends on PCB coordinate scaling */
}
-/* wind_double:
- * returns 1,0,-1 for counterclockwise, collinear or clockwise, respectively.
- */
-int
-wind_double(gdouble p1_x, gdouble p1_y, gdouble p2_x, gdouble p2_y, gdouble p3_x, gdouble p3_y)
-{
- double rval, dx1, dx2, dy1, dy2;
- dx1 = p2_x - p1_x; dy1 = p2_y - p1_y;
- dx2 = p3_x - p2_x; dy2 = p3_y - p2_y;
- rval = (dx1*dy2)-(dy1*dx2);
- return (rval > 0.0001) ? 1 : ((rval < -0.0001) ? -1 : 0);
-}
-
static inline void
print_toporouter_constraint(toporouter_constraint_t *tc)
{
commit 1a6a473a21f150139a383b6fa39e8865ceb5f02d
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Remove unused sloppy_.*wind() functions
diff --git a/src/toporouter.c b/src/toporouter.c
index 609a53d..000da7b 100644
--- a/src/toporouter.c
+++ b/src/toporouter.c
@@ -772,22 +772,6 @@ tvertex_wind(toporouter_vertex_t *a, toporouter_vertex_t *b, toporouter_vertex
return point_wind(GTS_POINT(a), GTS_POINT(b), GTS_POINT(c));
}
-int
-sloppy_point_wind(GtsPoint *a, GtsPoint *b, GtsPoint *c)
-{
- gdouble rval, dx1, dx2, dy1, dy2;
- dx1 = b->x - a->x; dy1 = b->y - a->y;
- dx2 = c->x - b->x; dy2 = c->y - b->y;
- rval = (dx1*dy2)-(dy1*dx2);
- return (rval > 10.) ? 1 : ((rval < -10.) ? -1 : 0);
-}
-
-static inline int
-sloppy_vertex_wind(GtsVertex *a, GtsVertex *b, GtsVertex *c)
-{
- return point_wind(GTS_POINT(a), GTS_POINT(b), GTS_POINT(c));
-}
-
/* moves vertex v d units in the direction of vertex p */
static void
coord_move_towards_coord_values (double ax, double ay,
commit 421c487a1adc5f93a5d1ef2b7a0085750b161b0a
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter: Re-implement functions using atan with atan2
Simplifies and condenses the code a lot.
diff --git a/src/toporouter.c b/src/toporouter.c
index c186d4a..609a53d 100644
--- a/src/toporouter.c
+++ b/src/toporouter.c
@@ -723,53 +723,20 @@ print_trace (void)
free (strings);
}
*/
-/* fills in x and y with coordinates of point from a towards b of distance d */
-void
-point_from_point_to_point(toporouter_vertex_t *a, toporouter_vertex_t *b, gdouble d, gdouble *x, gdouble *y)
-{
- gdouble dx = vx(b) - vx(a);
- gdouble dy = vy(b) - vy(a);
- gdouble theta = atan(fabs(dy/dx));
-
-//#ifdef DEBUG_EXPORT
- if(!finite(theta)) {
-// printf("!finte(theta): a = %f,%f b = %f,%f d = %f\n", vx(a), vy(a), vx(b), vy(b), d);
-// print_trace();
- //TODO: this shouldn't happen, fix the hack
- *x = vx(a);
- *y = vy(a);
- return;
- }
-//#endif
-
- g_assert(finite(theta));
-
- *x = vx(a); *y = vy(a);
-
- if( dx >= 0. ) {
- if( dy >= 0. ) {
- *x += d * cos(theta);
- *y += d * sin(theta);
- }else{
- *x += d * cos(theta);
- *y -= d * sin(theta);
- }
-
- }else{
-
- if( dy >= 0. ) {
- *x -= d * cos(theta);
- *y += d * sin(theta);
- }else{
- *x -= d * cos(theta);
- *y -= d * sin(theta);
- }
+/* fills in x and y with coordinates of point from a towards b of distance d */
+static void
+point_from_point_to_point (toporouter_vertex_t *a,
+ toporouter_vertex_t *b,
+ double d,
+ double *x, double *y)
+{
+ double theta = atan2 (vy(b) - vy(a), vx(b) - vx(a));
- }
+ *x = vx(a) + d * cos (theta);
+ *y = vy(a) + d * sin (theta);
}
-
static inline gint
coord_wind(gdouble ax, gdouble ay, gdouble bx, gdouble by, gdouble cx, gdouble cy)
{
@@ -822,78 +789,30 @@ sloppy_vertex_wind(GtsVertex *a, GtsVertex *b, GtsVertex *c)
}
/* moves vertex v d units in the direction of vertex p */
-void
-coord_move_towards_coord_values(gdouble ax, gdouble ay, gdouble px, gdouble py, gdouble d, gdouble *x, gdouble *y)
+static void
+coord_move_towards_coord_values (double ax, double ay,
+ double px, double py,
+ double d,
+ double *x, double *y)
{
- gdouble dx = px - ax;
- gdouble dy = py - ay;
- gdouble theta = atan(fabs(dy/dx));
-
-
- if(!finite(theta)) {
- printf("!finite(theta) a = %f,%f p = %f,%f d = %f\n",
- ax, ay, px, py, d);
-
- }
-
- g_assert(finite(theta));
-
- if( dx >= 0. ) {
-
- if( dy >= 0. ) {
- *x = ax + (d * cos(theta));
- *y = ay + (d * sin(theta));
- }else{
- *x = ax + (d * cos(theta));
- *y = ay - (d * sin(theta));
- }
-
- }else{
-
- if( dy >= 0. ) {
- *x = ax - (d * cos(theta));
- *y = ay + (d * sin(theta));
- }else{
- *x = ax - (d * cos(theta));
- *y = ay - (d * sin(theta));
- }
-
- }
+ double theta = atan2 (py - ay, px - ax);
+ *x = ax + d * cos (theta);
+ *y = ay + d * sin (theta);
}
/* moves vertex v d units in the direction of vertex p */
-void
-vertex_move_towards_vertex_values(GtsVertex *v, GtsVertex *p, gdouble d, gdouble *x, gdouble *y)
+static void
+vertex_move_towards_vertex_values (GtsVertex *v,
+ GtsVertex *p,
+ double d,
+ double *x, double *y)
{
- gdouble dx = GTS_POINT(p)->x - GTS_POINT(v)->x;
- gdouble dy = GTS_POINT(p)->y - GTS_POINT(v)->y;
- gdouble theta = atan(fabs(dy/dx));
-
- g_assert(finite(theta));
-
- if( dx >= 0. ) {
-
- if( dy >= 0. ) {
- *x = GTS_POINT(v)->x + (d * cos(theta));
- *y = GTS_POINT(v)->y + (d * sin(theta));
- }else{
- *x = GTS_POINT(v)->x + (d * cos(theta));
- *y = GTS_POINT(v)->y - (d * sin(theta));
- }
-
- }else{
-
- if( dy >= 0. ) {
- *x = GTS_POINT(v)->x - (d * cos(theta));
- *y = GTS_POINT(v)->y + (d * sin(theta));
- }else{
- *x = GTS_POINT(v)->x - (d * cos(theta));
- *y = GTS_POINT(v)->y - (d * sin(theta));
- }
-
- }
+ double theta = atan2 (GTS_POINT(p)->y - GTS_POINT(v)->y,
+ GTS_POINT(p)->x - GTS_POINT(v)->x);
+ *x = GTS_POINT(v)->x + d * cos (theta);
+ *y = GTS_POINT(v)->y + d * sin (theta);
}
#define tv_on_layer(v,l) (l == TOPOROUTER_BBOX(TOPOROUTER_VERTEX(v)->boxes->data)->layer)
@@ -5107,36 +5026,15 @@ routing_return:
/* moves vertex v d units in the direction of vertex p */
void
-vertex_move_towards_vertex(GtsVertex *v, GtsVertex *p, gdouble d)
+vertex_move_towards_vertex (GtsVertex *v,
+ GtsVertex *p,
+ double d)
{
- gdouble dx = GTS_POINT(p)->x - GTS_POINT(v)->x;
- gdouble dy = GTS_POINT(p)->y - GTS_POINT(v)->y;
- gdouble theta = atan(fabs(dy/dx));
-
- g_assert(finite(theta));
-
- if( dx >= 0. ) {
-
- if( dy >= 0. ) {
- GTS_POINT(v)->x += d * cos(theta);
- GTS_POINT(v)->y += d * sin(theta);
- }else{
- GTS_POINT(v)->x += d * cos(theta);
- GTS_POINT(v)->y -= d * sin(theta);
- }
-
- }else{
-
- if( dy >= 0. ) {
- GTS_POINT(v)->x -= d * cos(theta);
- GTS_POINT(v)->y += d * sin(theta);
- }else{
- GTS_POINT(v)->x -= d * cos(theta);
- GTS_POINT(v)->y -= d * sin(theta);
- }
-
- }
+ double theta = atan2 (GTS_POINT(p)->y - GTS_POINT(v)->y,
+ GTS_POINT(p)->x - GTS_POINT(v)->x);
+ GTS_POINT(v)->x += d * cos (theta);
+ GTS_POINT(v)->y += d * sin (theta);
}
commit e873882e2465a74ef2c1b9cab54ed12dc170856e
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Replace coord_xangle() with coord_angle()
The new function returning the "normal" coordinate system angle one would
expect. Replace usage of coord_xangle() in export_pcb_drawarc() with the
new function.
PCB's arc angles are a bit nutty, so lets try to contain that strangeness
to the arc exporting routine!
diff --git a/src/toporouter.c b/src/toporouter.c
index ab1338c..c186d4a 100644
--- a/src/toporouter.c
+++ b/src/toporouter.c
@@ -2602,26 +2602,10 @@ visited_cmp(gconstpointer a, gconstpointer b)
return 0;
}
-gdouble
-coord_xangle(gdouble ax, gdouble ay, gdouble bx, gdouble by)
+static double
+coord_angle (double ax, double ay, double bx, double by)
{
- gdouble dx, dy, theta;
-
- dx = fabs(ax - bx);
- dy = fabs(ay - by);
-
- if(dx < EPSILON) {
- theta = M_PI / 2.;
- } else theta = atan(dy/dx);
-
- if(by <= ay) {
- if(bx < ax) theta = M_PI - theta;
- }else{
- if(bx < ax) theta += M_PI;
- else theta = (2 * M_PI) - theta;
- }
-
- return theta;
+ return atan2 (by - ay, bx - ax);
}
GList *
@@ -5416,7 +5400,11 @@ export_pcb_drawarc(guint layer, toporouter_arc_t *a, guint thickness, guint keep
wind = coord_wind(a->x0, a->y0, a->x1, a->y1, vx(a->centre), vy(a->centre));
- sa = coord_xangle(a->x0, a->y0, vx(a->centre), vy(a->centre)) * 180. / M_PI;
+ /* NB: PCB's arcs have a funny coorindate system, with 0 degrees as the -ve X axis (left),
+ * continuing clockwise, with +90 degrees being along the +ve Y axis (bottom). Because
+ * Y+ points down, our internal angles increase clockwise from the +ve X axis.
+ */
+ sa = (M_PI - coord_angle (vx (a->centre), vy (a->centre), a->x0, a->y0)) * 180. / M_PI;
theta = arc_angle(a);
commit 592a836a66f7ebdef6d72b1f79c21ddb5289a26e
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Remove unused point_xangle() function
(Unused since the previous commit)
diff --git a/src/toporouter.c b/src/toporouter.c
index 51c8de6..ab1338c 100644
--- a/src/toporouter.c
+++ b/src/toporouter.c
@@ -2624,29 +2624,6 @@ coord_xangle(gdouble ax, gdouble ay, gdouble bx, gdouble by)
return theta;
}
-gdouble
-point_xangle(GtsPoint *a, GtsPoint *b)
-{
- gdouble dx, dy, theta;
-
- dx = fabs(a->x - b->x);
- dy = fabs(a->y - b->y);
-
- if(dx < EPSILON) {
- theta = M_PI / 2.;
- } else theta = atan(dy/dx);
-
- if(b->y >= a->y) {
- if(b->x < a->x) theta = M_PI - theta;
- }else{
- if(b->x < a->x) theta += M_PI;
- else theta = (2 * M_PI) - theta;
- }
-
- return theta;
-}
-
-
GList *
cluster_vertices(toporouter_t *r, toporouter_cluster_t *c)
{
commit c4ffceda456e150f036c05c28ddf15d9782eacdd
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Remove unused region_span() function
diff --git a/src/toporouter.c b/src/toporouter.c
index 7fdd79d..51c8de6 100644
--- a/src/toporouter.c
+++ b/src/toporouter.c
@@ -3054,21 +3054,6 @@ angle_span(gdouble a1, gdouble a2)
}
gdouble
-region_span(toporouter_vertex_region_t *region)
-{
- gdouble a1,a2;
-
- g_assert(region->v1 != NULL);
- g_assert(region->v2 != NULL);
- g_assert(region->origin != NULL);
-
- a1 = point_xangle(GTS_POINT(region->origin), GTS_POINT(region->v1));
- a2 = point_xangle(GTS_POINT(region->origin), GTS_POINT(region->v2));
-
- return angle_span(a1, a2);
-}
-
-gdouble
edge_capacity(toporouter_edge_t *e)
{
return gts_point_distance(GTS_POINT(edge_v1(e)), GTS_POINT(edge_v2(e)));
commit 6027180567c13bb4d3ad1000ed8c966c5d8c7a55
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter: Remove unused vertex_move_towards_point[_values]() functions
diff --git a/src/toporouter.c b/src/toporouter.c
index fecc4d5..7fdd79d 100644
--- a/src/toporouter.c
+++ b/src/toporouter.c
@@ -864,40 +864,6 @@ coord_move_towards_coord_values(gdouble ax, gdouble ay, gdouble px, gdouble py,
/* moves vertex v d units in the direction of vertex p */
void
-vertex_move_towards_point_values(GtsVertex *v, gdouble px, gdouble py, gdouble d, gdouble *x, gdouble *y)
-{
- gdouble dx = px - GTS_POINT(v)->x;
- gdouble dy = py - GTS_POINT(v)->y;
- gdouble theta = atan(fabs(dy/dx));
-
- g_assert(finite(theta));
-
- if( dx >= 0. ) {
-
- if( dy >= 0. ) {
- *x = GTS_POINT(v)->x + (d * cos(theta));
- *y = GTS_POINT(v)->y + (d * sin(theta));
- }else{
- *x = GTS_POINT(v)->x + (d * cos(theta));
- *y = GTS_POINT(v)->y - (d * sin(theta));
- }
-
- }else{
-
- if( dy >= 0. ) {
- *x = GTS_POINT(v)->x - (d * cos(theta));
- *y = GTS_POINT(v)->y + (d * sin(theta));
- }else{
- *x = GTS_POINT(v)->x - (d * cos(theta));
- *y = GTS_POINT(v)->y - (d * sin(theta));
- }
-
- }
-
-}
-
-/* moves vertex v d units in the direction of vertex p */
-void
vertex_move_towards_vertex_values(GtsVertex *v, GtsVertex *p, gdouble d, gdouble *x, gdouble *y)
{
gdouble dx = GTS_POINT(p)->x - GTS_POINT(v)->x;
@@ -5195,40 +5161,6 @@ routing_return:
/* moves vertex v d units in the direction of vertex p */
void
-vertex_move_towards_point(GtsVertex *v, gdouble px, gdouble py, gdouble d)
-{
- gdouble dx = px - GTS_POINT(v)->x;
- gdouble dy = py - GTS_POINT(v)->y;
- gdouble theta = atan(fabs(dy/dx));
-
- g_assert(finite(theta));
-
- if( dx >= 0. ) {
-
- if( dy >= 0. ) {
- GTS_POINT(v)->x += d * cos(theta);
- GTS_POINT(v)->y += d * sin(theta);
- }else{
- GTS_POINT(v)->x += d * cos(theta);
- GTS_POINT(v)->y -= d * sin(theta);
- }
-
- }else{
-
- if( dy >= 0. ) {
- GTS_POINT(v)->x -= d * cos(theta);
- GTS_POINT(v)->y += d * sin(theta);
- }else{
- GTS_POINT(v)->x -= d * cos(theta);
- GTS_POINT(v)->y -= d * sin(theta);
- }
-
- }
-
-}
-
-/* moves vertex v d units in the direction of vertex p */
-void
vertex_move_towards_vertex(GtsVertex *v, GtsVertex *p, gdouble d)
{
gdouble dx = GTS_POINT(p)->x - GTS_POINT(v)->x;
commit ccc611da9065af30552e0774709584f49a4eba6c
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Fix constants which assumed CMIL for PCB's internal units
This should make the toporouter work again.
diff --git a/src/toporouter.c b/src/toporouter.c
index 73e3990..fecc4d5 100644
--- a/src/toporouter.c
+++ b/src/toporouter.c
@@ -59,6 +59,9 @@
#include "pcb-printf.h"
#define BOARD_EDGE_RESOLUTION MIL_TO_COORD (100.)
+#define VIA_COST_AS_DISTANCE MIL_TO_COORD (100.)
+#define ROAR_DETOUR_THRESHOLD MIL_TO_COORD (10.)
+
static void
toporouter_edge_init (toporouter_edge_t *edge)
@@ -339,7 +342,7 @@ toporouter_draw_vertex(gpointer item, gpointer data)
cairo_arc(dc->cr,
tv->v.p.x * dc->s + MARGIN,
tv->v.p.y * dc->s + MARGIN,
- 500. * dc->s, 0, 2 * M_PI);
+ MIL_TO_COORD (5.) * dc->s, 0, 2 * M_PI);
cairo_fill(dc->cr);
}else if(tv->flags & VERTEX_FLAG_GREEN) {
@@ -347,7 +350,7 @@ toporouter_draw_vertex(gpointer item, gpointer data)
cairo_arc(dc->cr,
tv->v.p.x * dc->s + MARGIN,
tv->v.p.y * dc->s + MARGIN,
- 500. * dc->s, 0, 2 * M_PI);
+ MIL_TO_COORD (5.) * dc->s, 0, 2 * M_PI);
cairo_fill(dc->cr);
}else if(tv->flags & VERTEX_FLAG_BLUE) {
@@ -355,7 +358,7 @@ toporouter_draw_vertex(gpointer item, gpointer data)
cairo_arc(dc->cr,
tv->v.p.x * dc->s + MARGIN,
tv->v.p.y * dc->s + MARGIN,
- 500. * dc->s, 0, 2 * M_PI);
+ MIL_TO_COORD (5.) * dc->s, 0, 2 * M_PI);
cairo_fill(dc->cr);
@@ -407,7 +410,7 @@ toporouter_draw_vertex(gpointer item, gpointer data)
cairo_arc(dc->cr,
tv->v.p.x * dc->s + MARGIN,
tv->v.p.y * dc->s + MARGIN,
- 400. * dc->s, 0, 2 * M_PI);
+ MIL_TO_COORD (4.) * dc->s, 0, 2 * M_PI);
cairo_fill(dc->cr);
break;
@@ -421,14 +424,14 @@ toporouter_draw_vertex(gpointer item, gpointer data)
cairo_arc(dc->cr,
tv->v.p.x * dc->s + MARGIN,
tv->v.p.y * dc->s + MARGIN,
- 500. * dc->s, 0, 2 * M_PI);
+ MIL_TO_COORD (5.) * dc->s, 0, 2 * M_PI);
cairo_fill(dc->cr);
}else if(tv->flags & VERTEX_FLAG_RED) {
cairo_set_source_rgba(dc->cr, 1., 0., 0., 0.8f);
cairo_arc(dc->cr,
tv->v.p.x * dc->s + MARGIN,
tv->v.p.y * dc->s + MARGIN,
- 500. * dc->s, 0, 2 * M_PI);
+ MIL_TO_COORD (5.) * dc->s, 0, 2 * M_PI);
cairo_fill(dc->cr);
}else if(tv->flags & VERTEX_FLAG_GREEN) {
@@ -436,7 +439,7 @@ toporouter_draw_vertex(gpointer item, gpointer data)
cairo_arc(dc->cr,
tv->v.p.x * dc->s + MARGIN,
tv->v.p.y * dc->s + MARGIN,
- 500. * dc->s, 0, 2 * M_PI);
+ MIL_TO_COORD (5.) * dc->s, 0, 2 * M_PI);
cairo_fill(dc->cr);
}
@@ -1032,7 +1035,7 @@ toporouter_draw_cluster(toporouter_t *r, drawing_context_t *dc, toporouter_clust
// if(box->point && vz(box->point) == layer) {
// cairo_set_source_rgba(dc->cr, red, green, blue, 0.8f);
-// cairo_arc(dc->cr, vx(box->point) * dc->s + MARGIN, vy(box->point) * dc->s + MARGIN, 500. * dc->s, 0, 2 * M_PI);
+// cairo_arc(dc->cr, vx(box->point) * dc->s + MARGIN, vy(box->point) * dc->s + MARGIN, MIL_TO_COORD (5.) * dc->s, 0, 2 * M_PI);
// cairo_fill(dc->cr);
// }
@@ -1079,7 +1082,7 @@ toporouter_draw_surface(toporouter_t *r, GtsSurface *s, char *filename, int w, i
cairo_arc(dc->cr,
tv->v.p.x * dc->s + MARGIN,
tv->v.p.y * dc->s + MARGIN,
- 500. * dc->s, 0, 2 * M_PI);
+ MIL_TO_COORD (5.) * dc->s, 0, 2 * M_PI);
cairo_fill(dc->cr);
}else if(tv->flags & VERTEX_FLAG_GREEN) {
@@ -1087,7 +1090,7 @@ toporouter_draw_surface(toporouter_t *r, GtsSurface *s, char *filename, int w, i
cairo_arc(dc->cr,
tv->v.p.x * dc->s + MARGIN,
tv->v.p.y * dc->s + MARGIN,
- 500. * dc->s, 0, 2 * M_PI);
+ MIL_TO_COORD (5.) * dc->s, 0, 2 * M_PI);
cairo_fill(dc->cr);
}else if(tv->flags & VERTEX_FLAG_BLUE) {
@@ -1095,7 +1098,7 @@ toporouter_draw_surface(toporouter_t *r, GtsSurface *s, char *filename, int w, i
cairo_arc(dc->cr,
tv->v.p.x * dc->s + MARGIN,
tv->v.p.y * dc->s + MARGIN,
- 500. * dc->s, 0, 2 * M_PI);
+ MIL_TO_COORD (5.) * dc->s, 0, 2 * M_PI);
cairo_fill(dc->cr);
}
@@ -1105,7 +1108,7 @@ toporouter_draw_surface(toporouter_t *r, GtsSurface *s, char *filename, int w, i
cairo_arc(dc->cr,
tv->v.p.x * dc->s + MARGIN,
tv->v.p.y * dc->s + MARGIN,
- 500. * dc->s, 0, 2 * M_PI);
+ MIL_TO_COORD (5.) * dc->s, 0, 2 * M_PI);
cairo_fill(dc->cr);
@@ -1194,14 +1197,14 @@ toporouter_draw_surface(toporouter_t *r, GtsSurface *s, char *filename, int w, i
cairo_arc(dc->cr,
tv->v.p.x * dc->s + MARGIN,
tv->v.p.y * dc->s + MARGIN,
- 500. * dc->s, 0, 2 * M_PI);
+ MIL_TO_COORD (5.) * dc->s, 0, 2 * M_PI);
cairo_fill(dc->cr);
}else if(tv->flags & VERTEX_FLAG_RED) {
cairo_set_source_rgba(dc->cr, 1., 0., 0., 0.8f);
cairo_arc(dc->cr,
tv->v.p.x * dc->s + MARGIN,
tv->v.p.y * dc->s + MARGIN,
- 500. * dc->s, 0, 2 * M_PI);
+ MIL_TO_COORD (5.) * dc->s, 0, 2 * M_PI);
cairo_fill(dc->cr);
}else if(tv->flags & VERTEX_FLAG_GREEN) {
@@ -1209,14 +1212,14 @@ toporouter_draw_surface(toporouter_t *r, GtsSurface *s, char *filename, int w, i
cairo_arc(dc->cr,
tv->v.p.x * dc->s + MARGIN,
tv->v.p.y * dc->s + MARGIN,
- 500. * dc->s, 0, 2 * M_PI);
+ MIL_TO_COORD (5.) * dc->s, 0, 2 * M_PI);
cairo_fill(dc->cr);
}else{
cairo_set_source_rgba(dc->cr, 1., 1., 1., 0.8f);
cairo_arc(dc->cr,
tv->v.p.x * dc->s + MARGIN,
tv->v.p.y * dc->s + MARGIN,
- 500. * dc->s, 0, 2 * M_PI);
+ MIL_TO_COORD (5.) * dc->s, 0, 2 * M_PI);
cairo_fill(dc->cr);
}
i = i->next;
@@ -1289,7 +1292,7 @@ wind(toporouter_spoint_t *p1, toporouter_spoint_t *p2, toporouter_spoint_t *p3)
dx1 = p2->x - p1->x; dy1 = p2->y - p1->y;
dx2 = p3->x - p2->x; dy2 = p3->y - p2->y;
rval = (dx1*dy2)-(dy1*dx2);
- return (rval > 0.0001) ? 1 : ((rval < -0.0001) ? -1 : 0);
+ return (rval > 0.0001) ? 1 : ((rval < -0.0001) ? -1 : 0); /* XXX: Depends on PCB coordinate scaling */
}
/* wind_double:
@@ -5491,7 +5494,7 @@ export_pcb_drawline(guint layer, guint x0, guint y0, guint x1, guint y1, guint t
if(line) {
AddObjectToCreateUndoList (LINE_TYPE, LAYER_PTR(layer), line, line);
- d = coord_distance((double)x0, (double)y0, (double)x1, (double)y1) / 100.;
+ d = coord_distance((double)x0, (double)y0, (double)x1, (double)y1);
}
return d;
}
@@ -5538,7 +5541,7 @@ export_pcb_drawarc(guint layer, toporouter_arc_t *a, guint thickness, guint keep
if(arc) {
AddObjectToCreateUndoList( ARC_TYPE, LAYER_PTR(layer), arc, arc);
- d = a->r * theta / 100.;
+ d = a->r * theta;
}
return d;
@@ -6020,8 +6023,8 @@ check_non_intersect_vertex(gdouble x0, gdouble y0, gdouble x1, gdouble y1, topor
}else{
m = cartesian_gradient(x0, y0, x1, y1);
}
-
- coords_on_line(vx(arcv), vy(arcv), m, 100., &tx0, &ty0, &tx1, &ty1);
+
+ coords_on_line(vx(arcv), vy(arcv), m, MIL_TO_COORD (1.), &tx0, &ty0, &tx1, &ty1);
wind1 = coord_wind(tx0, ty0, tx1, ty1, line_int_x, line_int_y);
wind2 = coord_wind(tx0, ty0, tx1, ty1, vx(opv), vy(opv));
@@ -6810,9 +6813,13 @@ toporouter_export(toporouter_t *r)
i = i->next;
}
- Message(_("Reticulating splines... successful\n\n"));
- Message(_("Wiring cost: %f inches\n"), r->wiring_score / 1000.);
- printf("Wiring cost: %f inches\n", r->wiring_score / 1000.);
+ Message (_("Reticulating splines... successful\n\n"));
+ /* NB: We could use the %$mS specifier to print these distances, but we would
+ * have to cast to Coord, which might overflow for complex routing when
+ * PCB is built with Coord as a 32-bit integer.
+ */
+ Message (_("Wiring cost: %f inches\n"), COORD_TO_INCH (r->wiring_score));
+ printf ("Wiring cost: %f inches\n", COORD_TO_INCH (r->wiring_score));
g_list_free(oproutes);
@@ -7746,7 +7753,7 @@ detour_router(toporouter_t *r)
// vx(curroute->mergebox1->point), vy(curroute->mergebox1->point),
// vx(curroute->mergebox2->point), vy(curroute->mergebox2->point));
- if(curroute->score - curroute->detourscore > 1000.) {
+ if(curroute->score - curroute->detourscore > ROAR_DETOUR_THRESHOLD) {
roar_detour_route(r, curroute);
}else break;
@@ -7821,6 +7828,7 @@ parse_arguments(toporouter_t *r, int argc, char **argv)
int i, tempint;
for(i=0;i<argc;i++) {
if(sscanf(argv[i], "viacost=%d", &tempint)) {
+ /* XXX: We should be using PCB's generic value with unit parsing here */
r->viacost = (double)tempint;
}else if(sscanf(argv[i], "l%d", &tempint)) {
gdouble *layer = (gdouble *)malloc(sizeof(gdouble));
@@ -7857,7 +7865,7 @@ toporouter_new(void)
r->layers = NULL;
r->flags = 0;
r->viamax = 3;
- r->viacost = 10000.;
+ r->viacost = VIA_COST_AS_DISTANCE;
r->stublength = 300.;
r->serpintine_half_amplitude = 1500.;
commit e0c189a781e127c750243dbb4172d4778a6850fd
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.c: Fixup and clean read_board_constraints() and create_board_edge()
Introduce a #defined constant which expresses how fine to break the board
edges into (the old hard-coded constant was broken since we changed to
nanometers).
diff --git a/src/toporouter.c b/src/toporouter.c
index 734c733..73e3990 100644
--- a/src/toporouter.c
+++ b/src/toporouter.c
@@ -58,6 +58,8 @@
#include "toporouter.h"
#include "pcb-printf.h"
+#define BOARD_EDGE_RESOLUTION MIL_TO_COORD (100.)
+
static void
toporouter_edge_init (toporouter_edge_t *edge)
{
@@ -2207,52 +2209,44 @@ read_lines(toporouter_t *r, toporouter_layer_t *l, LayerType *layer, int ln)
return 0;
}
-void
-create_board_edge(gdouble x0, gdouble y0, gdouble x1, gdouble y1, gdouble max, gint layer, GList **vlist)
+static void
+create_board_edge (double x0, double y0,
+ double x1, double y1,
+ int layer,
+ GList **vlist)
{
GtsVertexClass *vertex_class = GTS_VERTEX_CLASS (toporouter_vertex_class ());
- gdouble d = sqrt(pow(x0-x1,2) + pow(y0-y1,2));
- guint n = d / max, count = 1;
- gdouble inc = n ? d / n : d;
- gdouble x = x0, y = y0;
+ double edge_length = sqrt (pow (x0 - x1, 2) + pow (y0 - y1, 2));
+ unsigned int vertices_per_edge = MIN (1, edge_length / BOARD_EDGE_RESOLUTION);
+ unsigned int count;
+ double inc = edge_length / vertices_per_edge;
+ double x = x0, y = y0;
- *vlist = g_list_prepend(*vlist, gts_vertex_new (vertex_class, x0, y0, layer));
-
- while(count < n) {
- coord_move_towards_coord_values(x0, y0, x1, y1, inc, &x, &y);
- *vlist = g_list_prepend(*vlist, gts_vertex_new (vertex_class, x, y, layer));
+ *vlist = g_list_prepend (*vlist, gts_vertex_new (vertex_class, x, y, layer));
- x0 = x; y0 = y;
- count++;
+ for (count = 1; count < vertices_per_edge; count ++) {
+ coord_move_towards_coord_values (x, y, x1, y1, inc, &x, &y);
+ *vlist = g_list_prepend (*vlist, gts_vertex_new (vertex_class, x, y, layer));
}
-
}
-int
-read_board_constraints(toporouter_t *r, toporouter_layer_t *l, int layer)
+static void
+read_board_constraints (toporouter_t *r, toporouter_layer_t *l, int layer)
{
-// GtsVertexClass *vertex_class = GTS_VERTEX_CLASS (toporouter_vertex_class ());
GList *vlist = NULL;
- toporouter_bbox_t *bbox = NULL;
-
- /* Add points for corners of board, and constrain those edges */
-// vlist = g_list_prepend(NULL, gts_vertex_new (vertex_class, 0., 0., layer));
-// vlist = g_list_prepend(vlist, gts_vertex_new (vertex_class, PCB->MaxWidth, 0., layer));
-// vlist = g_list_prepend(vlist, gts_vertex_new (vertex_class, PCB->MaxWidth, PCB->MaxHeight, layer));
-// vlist = g_list_prepend(vlist, gts_vertex_new (vertex_class, 0., PCB->MaxHeight, layer));
-
- create_board_edge(0., 0., PCB->MaxWidth, 0., 10000., layer, &vlist);
- create_board_edge(PCB->MaxWidth, 0., PCB->MaxWidth, PCB->MaxHeight, 10000., layer, &vlist);
- create_board_edge(PCB->MaxWidth, PCB->MaxHeight, 0., PCB->MaxHeight, 10000., layer, &vlist);
- create_board_edge(0., PCB->MaxHeight, 0., 0., 10000., layer, &vlist);
-
- bbox = toporouter_bbox_create(layer, vlist, BOARD, NULL);
- r->bboxes = g_slist_prepend(r->bboxes, bbox);
- insert_constraints_from_list(r, l, vlist, bbox);
- g_list_free(vlist);
+ toporouter_bbox_t *bbox;
- return 0;
+ /* Create points for the board edges and constrain those edges */
+ create_board_edge (0., 0., PCB->MaxWidth, 0., layer, &vlist);
+ create_board_edge (PCB->MaxWidth, 0., PCB->MaxWidth, PCB->MaxHeight, layer, &vlist);
+ create_board_edge (PCB->MaxWidth, PCB->MaxHeight, 0., PCB->MaxHeight, layer, &vlist);
+ create_board_edge (0., PCB->MaxHeight, 0., 0., layer, &vlist);
+
+ bbox = toporouter_bbox_create (layer, vlist, BOARD, NULL);
+ r->bboxes = g_slist_prepend (r->bboxes, bbox);
+ insert_constraints_from_list (r, l, vlist, bbox);
+ g_list_free (vlist);
}
gdouble
commit 296506b9a68ec4fcf01e455cd1734772adcf154e
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporoute.c: Remove runtime Copyright message from toporouter
Not only is Anthony now not the only author of this code, we don't do
this for anything else.. why should we for this. It could potentially act
to discorage others from working on this code, and we don't want that.
diff --git a/src/toporouter.c b/src/toporouter.c
index bff1e7a..734c733 100644
--- a/src/toporouter.c
+++ b/src/toporouter.c
@@ -7887,7 +7887,6 @@ toporouter_new(void)
Message(_("Topological Autorouter\n"));
Message(_("Started %s"),asctime(localtime(<ime)));
Message(_("-------------------------------------\n"));
- Message(_("Copyright 2009 Anthony Blake (tonyb33@xxxxxxxxx)\n\n"));
return r;
}
commit 02f0d48542c2d322c377ab3f353667cbcb81928c
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
toporouter.[ch]: Add generic "contributors" copyright notice
"Copyright (C) 2009-2011 PCB Contibrutors (See ChangeLog for details)"
diff --git a/src/toporouter.c b/src/toporouter.c
index e5310b0..bff1e7a 100644
--- a/src/toporouter.c
+++ b/src/toporouter.c
@@ -1,9 +1,10 @@
/*
* COPYRIGHT
*
- * Topological Autorouter for
+ * Topological Autorouter for
* PCB, interactive printed circuit board design
* Copyright (C) 2009 Anthony Blake
+ * Copyright (C) 2009-2011 PCB Contributors (see ChangeLog for details)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -27,9 +28,9 @@
* This is *EXPERIMENTAL* code.
*
* As the code is experimental, the algorithms and code
- * are likely to change. Which means it isn't documented
+ * are likely to change. Which means it isn't documented
* or optimized. If you would like to learn about Topological
- * Autorouters, the following papers are good starting points:
+ * Autorouters, the following papers are good starting points:
*
* This file implements a topological autorouter, and uses techniques from the
* following publications:
diff --git a/src/toporouter.h b/src/toporouter.h
index fcd0053..9e8a67d 100644
--- a/src/toporouter.h
+++ b/src/toporouter.h
@@ -1,9 +1,10 @@
/*
* COPYRIGHT
*
- * Topological Autorouter for
+ * Topological Autorouter for
* PCB, interactive printed circuit board design
* Copyright (C) 2009 Anthony Blake
+ * Copyright (C) 2009-2011 PCB Contributors (see ChangeLog for details)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs