Commit fcc86fb0 authored by dickelbeck's avatar dickelbeck

fix for magnetic tracks for parallel case, cleanup of original patches

parent 4b04d6c2
......@@ -890,8 +890,8 @@ bool TRACK::HitTest( const wxPoint& ref_pos )
if( Type() == TYPEVIA ) /* VIA rencontree */
{
return (int64_t) spot_cX*spot_cX + (int64_t) spot_cY*spot_cY <=
(int64_t) l_piste*l_piste;
return (double) spot_cX * spot_cX + (double) spot_cY * spot_cY <=
(double) l_piste * l_piste;
}
else
{
......
......@@ -233,20 +233,20 @@ static bool Join( wxPoint* res, wxPoint a0, wxPoint a1, wxPoint b0, wxPoint b1 )
http://www.gekkou.co.uk/blogs/monologues/2007/12/13/1197586800000.html
*/
int64_t denom;
double denom;
double t;
a1 -= a0;
b1 -= b0;
b0 -= a0;
denom = (int64_t) b1.y * a1.x - (int64_t) b1.x * a1.y;
denom = (double) b1.y * a1.x - (double) b1.x * a1.y;
if( !denom )
{
return false; // parallel
}
t = ((int64_t) b1.y * b0.x - (int64_t) b1.x * b0.y ) / (double) denom;
t = ((double) b1.y * b0.x - (double) b1.x * b0.y ) / denom;
t = min( max( t, 0.0 ), 1.0 );
......@@ -271,14 +271,14 @@ bool Project( wxPoint* res, wxPoint on_grid, const TRACK* track )
vec = track->m_End-track->m_Start;
t = (int64_t) (on_grid.x-track->m_Start.x)*vec.x +
(int64_t) (on_grid.y-track->m_Start.y)*vec.y;
t = double( on_grid.x - track->m_Start.x ) * vec.x +
double( on_grid.y - track->m_Start.y ) * vec.y;
t /= (int64_t) vec.x*vec.x + (int64_t) vec.y*vec.y;
t /= (double) vec.x * vec.x + (double) vec.y * vec.y;
t = min( max( t, 0.0 ), 1.0 );
res->x = (int) round( track->m_Start.x + t*vec.x );
res->y = (int) round( track->m_Start.y + t*vec.y );
res->x = (int) round( track->m_Start.x + t * vec.x );
res->y = (int) round( track->m_Start.y + t * vec.y );
return true;
}
......
......@@ -531,8 +531,8 @@ TRACK* LocateIntrusion( TRACK* start, int net, int width )
found = track;
/* prefer intrusions from the side, not the end */
int64_t tmp = (int64_t) pos.x * vec.x + (int64_t) pos.y * vec.y;
if( tmp >= 0 && tmp <= (int64_t) vec.x * vec.x + (int64_t) vec.y * vec.y )
double tmp = (double) pos.x * vec.x + (double) pos.y * vec.y;
if( tmp >= 0 && tmp <= (double) vec.x * vec.x + (double) vec.y * vec.y )
break;
}
}
......@@ -564,7 +564,7 @@ static void PushTrack( WinEDA_DrawPanel* panel )
wxPoint cv, vec, n;
TRACK* track = g_CurrentTrackSegment;
TRACK* other;
int64_t det;
double det;
int dist;
double f;
......@@ -580,7 +580,7 @@ static void PushTrack( WinEDA_DrawPanel* panel )
cv = cursor - other->m_Start;
vec = other->m_End - other->m_Start;
det = (int64_t) cv.x * vec.y - (int64_t) cv.y * vec.x;
det = (double) cv.x * vec.y - (double) cv.y * vec.x;
/* cursor is right at the center of the old track */
if( !det )
......@@ -605,7 +605,7 @@ static void PushTrack( WinEDA_DrawPanel* panel )
n.x = -vec.y;
n.y = vec.x;
}
f = dist / hypot( n.x, n.y );
f = dist / hypot( double(n.x), double(n.y) );
n.x = (int) round( f * n.x );
n.y = (int) round( f * n.y );
......
......@@ -506,6 +506,15 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError )
PADSTACK* padstack = library.FindPADSTACK( wire_via->GetPadstackId() );
if( !padstack )
{
// Dick Feb 29, 2008:
// Freerouter has a bug where it will not round trip all vias.
// Vias which have a (use_via) element will be round tripped.
// Vias which do not, don't come back in in the session library,
// even though they may be actually used in the pre-routed,
// protected wire_vias. So until that is fixed, create the
// padstack from its name as a work around.
// Could use a STRINGFORMATTER here and convert the entire
// wire_via to text and put that text into the exception.
wxString psid( CONV_FROM_UTF8( wire_via->GetPadstackId().c_str() ) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment