Remove outdated RoundTo0
With internal units in 100nm, there are no rounding errors when representing mm coordinates in eeschema.
This commit is contained in:
parent
a5c7d452ce
commit
850ca98e7b
|
@ -230,29 +230,6 @@ timestamp_t GetNewTimeStamp()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
double RoundTo0( double x, double precision )
|
|
||||||
{
|
|
||||||
assert( precision != 0 );
|
|
||||||
|
|
||||||
long long ix = KiROUND( x * precision );
|
|
||||||
|
|
||||||
if ( x < 0.0 )
|
|
||||||
ix = -ix;
|
|
||||||
|
|
||||||
int remainder = ix % 10; // remainder is in precision mm
|
|
||||||
|
|
||||||
if( remainder <= 2 )
|
|
||||||
ix -= remainder; // truncate to the near number
|
|
||||||
else if( remainder >= 8 )
|
|
||||||
ix += 10 - remainder; // round to near number
|
|
||||||
|
|
||||||
if ( x < 0 )
|
|
||||||
ix = -ix;
|
|
||||||
|
|
||||||
return (double) ix / precision;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::unique_ptr<wxConfigBase> GetNewConfig( const wxString& aProgName )
|
std::unique_ptr<wxConfigBase> GetNewConfig( const wxString& aProgName )
|
||||||
{
|
{
|
||||||
wxFileName configname;
|
wxFileName configname;
|
||||||
|
|
|
@ -185,12 +185,6 @@ void SCH_BASE_FRAME::UpdateStatusBar()
|
||||||
double dXpos = To_User_Unit( GetUserUnits(), cursorPos.x );
|
double dXpos = To_User_Unit( GetUserUnits(), cursorPos.x );
|
||||||
double dYpos = To_User_Unit( GetUserUnits(), cursorPos.y );
|
double dYpos = To_User_Unit( GetUserUnits(), cursorPos.y );
|
||||||
|
|
||||||
if( GetUserUnits() == EDA_UNITS::MILLIMETRES )
|
|
||||||
{
|
|
||||||
dXpos = RoundTo0( dXpos, 100.0 );
|
|
||||||
dYpos = RoundTo0( dYpos, 100.0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
wxString absformatter;
|
wxString absformatter;
|
||||||
wxString locformatter;
|
wxString locformatter;
|
||||||
|
|
||||||
|
@ -226,12 +220,6 @@ void SCH_BASE_FRAME::UpdateStatusBar()
|
||||||
dXpos = To_User_Unit( GetUserUnits(), dx );
|
dXpos = To_User_Unit( GetUserUnits(), dx );
|
||||||
dYpos = To_User_Unit( GetUserUnits(), dy );
|
dYpos = To_User_Unit( GetUserUnits(), dy );
|
||||||
|
|
||||||
if( GetUserUnits() == EDA_UNITS::MILLIMETRES )
|
|
||||||
{
|
|
||||||
dXpos = RoundTo0( dXpos, 100.0 );
|
|
||||||
dYpos = RoundTo0( dYpos, 100.0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
// We already decided the formatter above
|
// We already decided the formatter above
|
||||||
line.Printf( locformatter, dXpos, dYpos, hypot( dXpos, dYpos ) );
|
line.Printf( locformatter, dXpos, dYpos, hypot( dXpos, dYpos ) );
|
||||||
SetStatusText( line, 3 );
|
SetStatusText( line, 3 );
|
||||||
|
|
|
@ -217,16 +217,6 @@ int GetCommandOptions( const int argc, const char** argv,
|
||||||
const char* stringtst, const char** optarg,
|
const char* stringtst, const char** optarg,
|
||||||
int* optind );
|
int* optind );
|
||||||
|
|
||||||
/**
|
|
||||||
* Round to the nearest precision.
|
|
||||||
*
|
|
||||||
* Try to approximate a coordinate using a given precision to prevent
|
|
||||||
* rounding errors when converting from inches to mm.
|
|
||||||
*
|
|
||||||
* ie round the unit value to 0 if unit is 1 or 2, or 8 or 9
|
|
||||||
*/
|
|
||||||
double RoundTo0( double x, double precision );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Split \a aString to a string list separated at \a aSplitter.
|
* Split \a aString to a string list separated at \a aSplitter.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue