Commit 387a8763 authored by CHARRAS's avatar CHARRAS

Removed enhancements in connectivity computation (in certain cases, does not work)

parent 0d403649
...@@ -4,6 +4,17 @@ Started 2007-June-11 ...@@ -4,6 +4,17 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2007-Oct-17 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+ pcbnew:
Removed enhancements in connectivity computation because
rastnest computation does not work (errors) with short track segments
(lenght < width) . This is not a bug, but an algorithm problem, so
I must work on algos.
2007-Oct-17 UPDATE Geoff Harland <gharlandau@yahoo.com.au> 2007-Oct-17 UPDATE Geoff Harland <gharlandau@yahoo.com.au>
================================================================================ ================================================================================
+ pcbnew + pcbnew
......
...@@ -502,7 +502,6 @@ public: ...@@ -502,7 +502,6 @@ public:
int* build_ratsnest_pad( EDA_BaseStruct* ref, const wxPoint& refpos, bool init ); int* build_ratsnest_pad( EDA_BaseStruct* ref, const wxPoint& refpos, bool init );
void Tst_Ratsnest( wxDC* DC, int ref_netcode ); void Tst_Ratsnest( wxDC* DC, int ref_netcode );
void Recalcule_all_net_connexion( wxDC* DC );
void test_connexions( wxDC* DC ); void test_connexions( wxDC* DC );
void test_1_net_connexion( wxDC* DC, int net_code ); void test_1_net_connexion( wxDC* DC, int net_code );
void reattribution_reference_piste( int affiche ); void reattribution_reference_piste( int affiche );
......
...@@ -16,6 +16,28 @@ ...@@ -16,6 +16,28 @@
#include "protos.h" #include "protos.h"
// #define RATSNET_DEBUG
#ifdef RATSNET_DEBUG
/**************************************/
void DbgDisplayTrackInfos(TRACK * track)
/**************************************/
/* Only for ratsnest debug
*/
{
wxString msg;
msg << wxT("Netcode ") << track->GetNet();
msg << wxT(" - ") << track->GetSubNet();
msg << wxT("\nptrS ") << (unsigned) track->start;
msg << wxT(" ptrE ") << (unsigned) track->end;
msg << wxT(" this ") << (unsigned) track;
wxMessageBox(msg);
}
#endif
/**************************************/ /**************************************/
/* Classes pour Pistes, Vias et Zones */ /* Classes pour Pistes, Vias et Zones */
/**************************************/ /**************************************/
...@@ -715,6 +737,9 @@ void TRACK::Display_Infos( WinEDA_DrawFrame* frame ) ...@@ -715,6 +737,9 @@ void TRACK::Display_Infos( WinEDA_DrawFrame* frame )
{ {
wxString msg; wxString msg;
int text_pos; int text_pos;
#ifdef RATSNET_DEBUG
DbgDisplayTrackInfos(this);
#endif
frame->MsgPanel->EraseMsgBox(); frame->MsgPanel->EraseMsgBox();
...@@ -865,6 +890,7 @@ bool TRACK::HitTest( const wxPoint& ref_pos ) ...@@ -865,6 +890,7 @@ bool TRACK::HitTest( const wxPoint& ref_pos )
} }
#if defined(DEBUG) #if defined(DEBUG)
/** /**
......
This diff is collapsed.
...@@ -664,18 +664,27 @@ TEXTE_MODULE* LocateTexteModule( BOARD* Pcb, MODULE** PtModule, int typeloc ) ...@@ -664,18 +664,27 @@ TEXTE_MODULE* LocateTexteModule( BOARD* Pcb, MODULE** PtModule, int typeloc )
/******************************************/ /******************************************************************/
inline int Dist(wxPoint & p1, wxPoint & p2) inline bool IsPointsAreNear(wxPoint & p1, wxPoint & p2, int max_dist)
/******************************************/ /******************************************************************/
/* /*
return the dist min between p1 and p2 return true if the dist between p1 and p2 < max_dist
Currently in test (currently rasnest algos work only if p1 == p2
*/ */
{ {
extern bool zflg;
if (zflg == true)
{
int dist; int dist;
dist = abs(p1.x - p2.x) + abs (p1.y - p2.y); dist = abs(p1.x - p2.x) + abs (p1.y - p2.y);
dist *= 7; dist *= 7;
dist /= 10; dist /= 10;
return dist; if ( dist < max_dist ) return true;
}
else
if ( p1 == p2 ) return true;
//#endif
return false;
} }
/**************************************************************/ /**************************************************************/
...@@ -683,25 +692,30 @@ TRACK* Locate_Piste_Connectee( TRACK* PtRefSegm, TRACK* pt_base, ...@@ -683,25 +692,30 @@ TRACK* Locate_Piste_Connectee( TRACK* PtRefSegm, TRACK* pt_base,
TRACK* pt_lim, int extr ) TRACK* pt_lim, int extr )
/**************************************************************/ /**************************************************************/
/* recherche le segment connecte au segment pointe par /** Search for the track (or via) segment which is connected to the track segment PtRefSegm
* PtRefSegm: * if extr == START, the starting track segment PtRefSegm is used to locate a connected segment
* si int extr = START, le point de debut du segment est utilise * if extr == END, the ending track segment PtRefSegm is used
* si int extr = END, le point de fin du segment est utilise * The test connection consider only end track segments
* La recherche ne se fait que sur les EXTREMITES des segments *
* Search is made from pt_base to pt_lim (in the track linked list)
* if pt_lim == NULL, the search is made from pt_base to the end of list
*
* In order to have a fast computation time:
* a first search is made considering only the +/- 50 next door neightbour of PtRefSegm.
* if no track is found : the entire list is tested
* *
* La recherche se fait de l'adresse : * @param PtRefSegm = reference segment
* pt_base a pt_lim (borne finale comprise) * @param pt_base = lower limit for search
* si pt_lim = NULL, la recherche se fait jusqu'a la fin de la liste * @param pt_lim = upper limit for search (can be NULL)
* Afin d'accelerer la recherche, une 1ere passe est faite, avec une recherche * @param extr = START or END = end of ref track segment to use in tests
* realisee sur un ensemble de +/- 100 points autour du point courant.
* Si echec: recherche generale
*/ */
{ {
#define NEIGHTBOUR_COUNT_MAX 50
TRACK* PtSegmB, * PtSegmN; TRACK* PtSegmB, * PtSegmN;
int Reflayer; int Reflayer;
wxPoint pos_ref; wxPoint pos_ref;
int ii; int ii;
int min_dist; int max_dist;
if( extr == START ) if( extr == START )
pos_ref = PtRefSegm->m_Start; pos_ref = PtRefSegm->m_Start;
...@@ -713,7 +727,7 @@ TRACK* Locate_Piste_Connectee( TRACK* PtRefSegm, TRACK* pt_base, ...@@ -713,7 +727,7 @@ TRACK* Locate_Piste_Connectee( TRACK* PtRefSegm, TRACK* pt_base,
/* 1ere passe */ /* 1ere passe */
PtSegmB = PtSegmN = PtRefSegm; PtSegmB = PtSegmN = PtRefSegm;
for( ii = 0; ii < 50; ii++ ) for( ii = 0; ii < NEIGHTBOUR_COUNT_MAX; ii++ )
{ {
if( (PtSegmN == NULL) && (PtSegmB == NULL) ) if( (PtSegmN == NULL) && (PtSegmB == NULL) )
break; break;
...@@ -725,15 +739,16 @@ TRACK* Locate_Piste_Connectee( TRACK* PtRefSegm, TRACK* pt_base, ...@@ -725,15 +739,16 @@ TRACK* Locate_Piste_Connectee( TRACK* PtRefSegm, TRACK* pt_base,
if( PtSegmN == PtRefSegm ) if( PtSegmN == PtRefSegm )
goto suite; goto suite;
min_dist = (PtSegmN->m_Width + PtRefSegm->m_Width)/2; /* max_dist is the max distance between 2 tack ends which ensure a copper continuty */
max_dist = (PtSegmN->m_Width + PtRefSegm->m_Width)/2;
if( Dist(pos_ref, PtSegmN->m_Start) < min_dist ) if( IsPointsAreNear(pos_ref, PtSegmN->m_Start, max_dist) )
{ /* Test des couches */ { /* Test des couches */
if( Reflayer & PtSegmN->ReturnMaskLayer() ) if( Reflayer & PtSegmN->ReturnMaskLayer() )
return PtSegmN; return PtSegmN;
} }
if( Dist(pos_ref, PtSegmN->m_End) < min_dist ) if( IsPointsAreNear(pos_ref, PtSegmN->m_End, max_dist) )
{ /* Test des couches */ { /* Test des couches */
if( Reflayer & PtSegmN->ReturnMaskLayer() ) if( Reflayer & PtSegmN->ReturnMaskLayer() )
return PtSegmN; return PtSegmN;
...@@ -752,15 +767,15 @@ suite: ...@@ -752,15 +767,15 @@ suite:
if( PtSegmB == PtRefSegm ) if( PtSegmB == PtRefSegm )
goto suite1; goto suite1;
min_dist = (PtSegmB->m_Width + PtRefSegm->m_Width)/2; max_dist = (PtSegmB->m_Width + PtRefSegm->m_Width)/2;
if( Dist(pos_ref, PtSegmB->m_Start) < min_dist ) if( IsPointsAreNear(pos_ref, PtSegmB->m_Start, max_dist) )
{ /* Test des couches */ { /* Test des couches */
if( Reflayer & PtSegmB->ReturnMaskLayer() ) if( Reflayer & PtSegmB->ReturnMaskLayer() )
return PtSegmB; return PtSegmB;
} }
if( Dist(pos_ref, PtSegmB->m_End) < min_dist ) if( IsPointsAreNear(pos_ref, PtSegmB->m_End, max_dist) )
{ /* Test des couches */ { /* Test des couches */
if( Reflayer & PtSegmB->ReturnMaskLayer() ) if( Reflayer & PtSegmB->ReturnMaskLayer() )
return PtSegmB; return PtSegmB;
...@@ -792,15 +807,15 @@ suite1: ...@@ -792,15 +807,15 @@ suite1:
} }
min_dist = (PtSegmN->m_Width + PtRefSegm->m_Width)/2; max_dist = (PtSegmN->m_Width + PtRefSegm->m_Width)/2;
if( Dist(pos_ref,PtSegmN->m_Start) < min_dist ) if( IsPointsAreNear(pos_ref,PtSegmN->m_Start, max_dist) )
{ /* Test des couches */ { /* Test des couches */
if( Reflayer & PtSegmN->ReturnMaskLayer() ) if( Reflayer & PtSegmN->ReturnMaskLayer() )
return PtSegmN; return PtSegmN;
} }
if( Dist(pos_ref, PtSegmN->m_End) < min_dist ) if( IsPointsAreNear(pos_ref, PtSegmN->m_End, max_dist) )
{ /* Test des couches */ { /* Test des couches */
if( Reflayer & PtSegmN->ReturnMaskLayer() ) if( Reflayer & PtSegmN->ReturnMaskLayer() )
return PtSegmN; return PtSegmN;
......
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