Browse Source

Cleanup spacemouse plugin

Sets std:: convention and unifies the defined/non-defined interface
7.0
Seth Hillbrand 4 years ago
parent
commit
0625e20fc0
  1. 2
      eeschema/navlib/nl_schematic_plugin.cpp
  2. 9
      libs/kimath/include/math/util.h

2
eeschema/navlib/nl_schematic_plugin.cpp

@ -48,7 +48,7 @@ void NL_SCHEMATIC_PLUGIN::SetCanvas( EDA_DRAW_PANEL_GAL* aViewport )
#else
NL_SCHEMATIC_PLUGIN::NL_SCHEMATIC_PLUGIN( EDA_DRAW_PANEL_GAL* aViewport )
NL_SCHEMATIC_PLUGIN::NL_SCHEMATIC_PLUGIN()
{
}

9
libs/kimath/include/math/util.h

@ -34,6 +34,7 @@
#define UTIL_H
#include <config.h>
#include <cmath>
#include <cstdint>
#include <limits>
#include <typeinfo>
@ -129,18 +130,18 @@ int64_t rescale( int64_t aNumerator, int64_t aValue, int64_t aDenominator );
* @return true if the values considered equal within the specified epsilon, otherwise false.
*/
template <class T>
typename std::enable_if<!std::numeric_limits<T>::is_integer, bool>::type
typename std::enable_if<std::is_floating_point<T>::value, bool>::type
equals( T aFirst, T aSecond, T aEpsilon = std::numeric_limits<T>::epsilon() )
{
T diff = fabs( aFirst - aSecond );
T diff = std::abs( aFirst - aSecond );
if( diff < aEpsilon )
{
return true;
}
aFirst = fabs( aFirst );
aSecond = fabs( aSecond );
aFirst = std::abs( aFirst );
aSecond = std::abs( aSecond );
T largest = aFirst > aSecond ? aFirst : aSecond;
if( diff <= largest * aEpsilon )

Loading…
Cancel
Save