KiCad PCB EDA Suite
CWORK Struct Reference

Public Member Functions

void CalculateCost ()
 

Public Attributes

int m_FromRow
 
int m_FromCol
 
int m_ToRow
 
int m_ToCol
 
RATSNEST_ITEM * m_Ratsnest
 
int m_NetCode
 
int m_ApxDist
 
int m_Cost
 
int m_Priority
 

Detailed Description

Definition at line 44 of file work.cpp.

Member Function Documentation

void CWORK::CalculateCost ( )

Definition at line 145 of file work.cpp.

References abs, m_Cost, m_FromCol, m_FromRow, m_ToCol, and m_ToRow.

Referenced by SetWork().

146 {
147  int dx, dy, mx, my;
148  double incl = 1.0;
149 
150  dx = abs( m_ToCol - m_FromCol );
151  dy = abs( m_ToRow - m_FromRow );
152  mx = dx;
153  my = dy;
154 
155  if( mx < my )
156  {
157  mx = dy; my = dx;
158  }
159 
160  if( mx )
161  incl += (2 * (double) my / mx);
162 
163  m_Cost = (int) ( ( dx + dy ) * incl );
164 }
int m_FromRow
Definition: work.cpp:47
int m_Cost
Definition: work.cpp:54
int m_ToRow
Definition: work.cpp:49
#define abs(a)
Definition: auxiliary.h:84
int m_ToCol
Definition: work.cpp:50
int m_FromCol
Definition: work.cpp:48

Member Data Documentation

int CWORK::m_ApxDist

Definition at line 53 of file work.cpp.

Referenced by SetWork().

int CWORK::m_Cost

Definition at line 54 of file work.cpp.

Referenced by CalculateCost(), and sort_by_cost().

int CWORK::m_FromCol

Definition at line 48 of file work.cpp.

Referenced by CalculateCost(), and SetWork().

int CWORK::m_FromRow

Definition at line 47 of file work.cpp.

Referenced by CalculateCost(), and SetWork().

int CWORK::m_NetCode

Definition at line 52 of file work.cpp.

Referenced by SetWork().

int CWORK::m_Priority

Definition at line 55 of file work.cpp.

Referenced by SetWork(), and sort_by_cost().

RATSNEST_ITEM* CWORK::m_Ratsnest

Definition at line 51 of file work.cpp.

Referenced by SetWork().

int CWORK::m_ToCol

Definition at line 50 of file work.cpp.

Referenced by CalculateCost(), and SetWork().

int CWORK::m_ToRow

Definition at line 49 of file work.cpp.

Referenced by CalculateCost(), and SetWork().


The documentation for this struct was generated from the following file: