Commit 09a61396 authored by Vladimir Ur's avatar Vladimir Ur

Some code restyling: VECTOR_PCB is an array. Cleanup uncontrolled definitions...

Some code restyling: VECTOR_PCB is an array. Cleanup uncontrolled definitions of abs, max, etc. max is now overloaded function and MAX is a macro.
parent 4b9b2f4e
......@@ -903,8 +903,8 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas )
int color;
scale = g_Parm_3D_Visu.m_BoardScale;
holeX = (double) TO_LEGACY_LU_DBL( m_Drill.x ) * scale / 2;
holeY = (double) TO_LEGACY_LU_DBL( m_Drill.y ) * scale / 2;
holeX = (double) TO_LEGACY_LU_DBL( m_Drill.x() ) * scale / 2;
holeY = (double) TO_LEGACY_LU_DBL( m_Drill.y() ) * scale / 2;
hole = MIN( holeX, holeY );
/* Calculate the center of the pad. */
......@@ -914,8 +914,8 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas )
xc = ux0;
yc = uy0;
dx = dx0 = TO_LEGACY_LU( m_Size.x ) >> 1;
dy = dy0 = TO_LEGACY_LU( m_Size.y ) >> 1;
dx = dx0 = TO_LEGACY_LU( m_Size.x() ) >> 1;
dy = dy0 = TO_LEGACY_LU( m_Size.y() ) >> 1;
angle = m_Orient;
drillx = m_Pos.x * scale;
......@@ -980,13 +980,13 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas )
{
delta_cx = dx - dy;
delta_cy = 0;
w = TO_LEGACY_LU( m_Size.y ) * scale;
w = TO_LEGACY_LU( m_Size.y() ) * scale;
}
else /* Vertical ellipse */
{
delta_cx = 0;
delta_cy = dy - dx;
w = TO_LEGACY_LU( m_Size.x ) * scale;
w = TO_LEGACY_LU( m_Size.x() ) * scale;
}
RotatePoint( &delta_cx, &delta_cy, angle );
......
......@@ -37,13 +37,6 @@
#include "auxiliary.h"
#ifndef max
#define max( a, b ) ( ( (a) > (b) ) ? (a) : (b) )
#endif
#ifndef min
#define min( a, b ) ( ( (a) < (b) ) ? (a) : (b) )
#endif
// Define some types used here from boost::polygon
namespace bpl = boost::polygon; // bpl = boost polygon library
using namespace bpl::operators; // +, -, =, ...
......@@ -476,7 +469,7 @@ void BezierToPolyline( std::vector <potrace_dpoint_t>& aCornersBuffer,
* occur at an endpoint. */
dd0 = sq( p1.x - 2 * p2.x + p3.x ) + sq( p1.y - 2 * p2.y + p3.y );
dd1 = sq( p2.x - 2 * p3.x + p4.x ) + sq( p2.y - 2 * p3.y + p4.y );
dd = 6 * sqrt( max( dd0, dd1 ) );
dd = 6 * sqrt( fmax( dd0, dd1 ) );
e2 = 8 * delta <= dd ? 8 * delta / dd : 1;
epsilon = sqrt( e2 ); /* necessary interval size */
......
......@@ -418,7 +418,7 @@ int ReturnValueFromString( EDA_UNITS_T aUnit, const wxString& TextValue, int Int
const LENGTH_UNIT_DESC MillimetreDesc =
{
LENGTH_UNITS<LENGTH_DEF>::millimetre(),
LENGTH_UNITS<LENGTH_PCB>::millimetre(),
wxT( "mm" ),
6
};
......@@ -426,7 +426,7 @@ const LENGTH_UNIT_DESC MillimetreDesc =
const LENGTH_UNIT_DESC InchDesc =
{
LENGTH_UNITS<LENGTH_DEF>::inch(),
LENGTH_UNITS<LENGTH_PCB>::inch(),
wxT( "\"" ),
7
};
......@@ -434,7 +434,7 @@ const LENGTH_UNIT_DESC InchDesc =
const LENGTH_UNIT_DESC MilDesc =
{
LENGTH_UNITS<LENGTH_DEF>::mil(),
LENGTH_UNITS<LENGTH_PCB>::mil(),
wxT( "mil" ),
5
};
......@@ -442,7 +442,7 @@ const LENGTH_UNIT_DESC MilDesc =
const LENGTH_UNIT_DESC UnscaledDesc = /* stub */
{
LENGTH_DEF::quantum(),
LENGTH_PCB::quantum(),
wxT( "" ),
4
};
......@@ -461,7 +461,7 @@ const LENGTH_UNIT_DESC *UnitDescription( EDA_UNITS_T aUnit ) {
/* TODO: localisation */
wxString LengthToString( const LENGTH_UNIT_DESC *aUnit, LENGTH_DEF aValue,
wxString LengthToString( const LENGTH_UNIT_DESC *aUnit, LENGTH_PCB aValue,
bool aAdd_unit_symbol ) {
wxString StringValue;
double value_to_print;
......@@ -490,10 +490,10 @@ wxString LengthToString( const LENGTH_UNIT_DESC *aUnit, LENGTH_DEF aValue,
return StringValue;
}
LENGTH_DEF StringToLength( const LENGTH_UNIT_DESC *aUnit, const wxString& TextValue )
LENGTH_PCB StringToLength( const LENGTH_UNIT_DESC *aUnit, const wxString& TextValue )
{
LENGTH_DEF Value;
LENGTH_PCB Value;
double dtmp = 0;
/* Acquire the 'right' decimal point separator */
......@@ -544,21 +544,21 @@ LENGTH_DEF StringToLength( const LENGTH_UNIT_DESC *aUnit, const wxString& TextVa
aUnit = &MilDesc;
}
Value = LENGTH_DEF( dtmp * LENGTH< double, 1 >( aUnit->m_Value ) );
Value = LENGTH_PCB( dtmp * LENGTH< double, 1 >( aUnit->m_Value ) );
return Value;
}
void LengthToTextCtrl( wxTextCtrl& TextCtr, LENGTH_DEF Value )
void LengthToTextCtrl( wxTextCtrl& TextCtr, LENGTH_PCB Value )
{
wxString msg = LengthToString( UnitDescription( g_UserUnit ), Value );
TextCtr.SetValue( msg );
}
LENGTH_DEF LengthFromTextCtrl( const wxTextCtrl& TextCtr )
LENGTH_PCB LengthFromTextCtrl( const wxTextCtrl& TextCtr )
{
LENGTH_DEF value;
LENGTH_PCB value;
wxString msg = TextCtr.GetValue();
value = StringToLength( UnitDescription( g_UserUnit ), msg );
......
......@@ -37,7 +37,7 @@
#ifdef KICAD_NANOMETRE
#include "length.h"
#include "lengthpcb.h"
#endif
class wxAboutDialogInfo;
......@@ -385,7 +385,7 @@ int ReturnValueFromTextCtrl( const wxTextCtrl& TextCtr, int Internal_Unit );
struct LENGTH_UNIT_DESC
{
LENGTH_DEF m_Value;
LENGTH_PCB m_Value;
const wxString m_Symbol;
int m_Precision;
};
......@@ -394,12 +394,12 @@ extern const LENGTH_UNIT_DESC MillimetreDesc, InchDesc, MilDesc;
const LENGTH_UNIT_DESC *UnitDescription( EDA_UNITS_T aUnit );
LENGTH_DEF StringToLength( const LENGTH_UNIT_DESC *aUnit, const wxString& TextValue );
wxString LengthToString( const LENGTH_UNIT_DESC *aUnit, LENGTH_DEF aValue,
LENGTH_PCB StringToLength( const LENGTH_UNIT_DESC *aUnit, const wxString& TextValue );
wxString LengthToString( const LENGTH_UNIT_DESC *aUnit, LENGTH_PCB aValue,
bool aAdd_unit_symbol = false );
void LengthToTextCtrl( wxTextCtrl& TextCtr, LENGTH_DEF Value );
LENGTH_DEF LengthFromTextCtrl( const wxTextCtrl& TextCtr );
void LengthToTextCtrl( wxTextCtrl& TextCtr, LENGTH_PCB Value );
LENGTH_PCB LengthFromTextCtrl( const wxTextCtrl& TextCtr );
/* transition macros */
#define STR_TO_LENGTH( unit, str, iu ) \
......
This diff is collapsed.
......@@ -8,6 +8,7 @@
#ifdef KICAD_NANOMETRE
#include "length.h"
#include "limited_int.h"
/* switched type! */
typedef LENGTH< LIMITED_INT< int >, 1 > LENGTH_PCB;
......@@ -82,53 +83,126 @@ typedef double LENGTH_PCB_DBL;
/// @TODO: nice template and refiling for it
struct VECTOR_PCB
class VECTOR_PCB
{
LENGTH_PCB x, y;
VECTOR_PCB()
public:
LENGTH_PCB data[2];
/** A vector from pair of coords. Constructor is avoided in favor to POD.
*/
static VECTOR_PCB fromXY( LENGTH_PCB x, LENGTH_PCB y )
{
VECTOR_PCB z = { x, y };
return z;
}
VECTOR_PCB( LENGTH_PCB ax, LENGTH_PCB ay ): x( ax ), y( ay )
LENGTH_PCB &operator[]( int i )
{
return data[i];
}
bool operator == ( const VECTOR_PCB &a ) const {
return x == a.x && y == a.y;
const LENGTH_PCB &operator[]( int i ) const
{
return data[i];
}
bool operator != ( const VECTOR_PCB &a ) const {
return x != a.x || y != a.y;
LENGTH_PCB & x()
{
return data[0];
}
VECTOR_PCB & operator = (const VECTOR_PCB &a ) {
x = a.x;
y = a.y;
return *this;
const LENGTH_PCB & x() const
{
return data[0];
}
LENGTH_PCB & y()
{
return data[1];
}
const LENGTH_PCB & y() const
{
return data[1];
}
//LENGTH_PCB x, y;
bool operator == ( const VECTOR_PCB &b ) const
{
return data[0] == b.data[0] && data[1] == b.data[1];
}
bool operator != ( const VECTOR_PCB &b ) const
{
return !(*this == b);
}
VECTOR_PCB & operator += (const VECTOR_PCB &a ) {
x += a.x;
y += a.y;
VECTOR_PCB & operator -= ( const VECTOR_PCB &b )
{
data[0] -= b.data[0];
data[1] -= b.data[1];
return *this;
}
VECTOR_PCB & operator -= (const VECTOR_PCB &a ) {
x -= a.x;
y -= a.y;
VECTOR_PCB operator - ( const VECTOR_PCB &b ) const
{
VECTOR_PCB z = *this;
z -= b;
return z;
}
VECTOR_PCB & operator += ( const VECTOR_PCB &b )
{
data[0] += b.data[0];
data[1] += b.data[1];
return *this;
}
VECTOR_PCB operator + (VECTOR_PCB add) const {
return VECTOR_PCB(x + add.x, y + add.y);
VECTOR_PCB operator + ( VECTOR_PCB b ) const
{
VECTOR_PCB z = *this;
z += b;
return z;
}
VECTOR_PCB operator - (VECTOR_PCB add) const {
return VECTOR_PCB(x - add.x, y - add.y);
VECTOR_PCB & operator *= ( int b )
{
data[0] *= b;
data[1] *= b;
return *this;
}
VECTOR_PCB operator * ( int b ) const
{
VECTOR_PCB z = *this;
z *= b;
return z;
}
VECTOR_PCB operator * (int factor) const {
return VECTOR_PCB(x * factor, y * factor);
VECTOR_PCB & operator /= ( int b )
{
data[0] /= b;
data[1] /= b;
return *this;
}
VECTOR_PCB operator / (int factor) const {
return VECTOR_PCB(x / factor, y / factor);
VECTOR_PCB operator / ( int b ) const
{
VECTOR_PCB z = *this;
z /= b;
return z;
}
};
#define TO_LEGACY_LU_WXP( p ) ( wxPoint( TO_LEGACY_LU( ( p ).x ), TO_LEGACY_LU( ( p ).y ) ) )
#define TO_LEGACY_LU_WXS( p ) ( wxSize( TO_LEGACY_LU( ( p ).x ), TO_LEGACY_LU( ( p ).y ) ) )
#define FROM_LEGACY_LU_VEC( p ) ( VECTOR_PCB( FROM_LEGACY_LU( ( p ).x ), FROM_LEGACY_LU( ( p ).y ) ) )
#define TO_LEGACY_LU_WXP( p ) ( wxPoint( \
TO_LEGACY_LU( ( p )[0] ), \
TO_LEGACY_LU( ( p )[1] ) ) )
#define TO_LEGACY_LU_WXS( p ) ( wxSize( \
TO_LEGACY_LU( ( p )[0] ), \
TO_LEGACY_LU( ( p )[1] ) ) )
#define FROM_LEGACY_LU_VEC( p ) ( VECTOR_PCB::fromXY( \
FROM_LEGACY_LU( ( p ).x ), \
FROM_LEGACY_LU( ( p ).y ) ) )
#endif /* def LENGTHPCB_H_INCLUDED */
......@@ -15,21 +15,25 @@
template < typename T = int > class LIMITED_INT {
private:
T m_Value;
public:
LIMITED_INT( void ) : m_Value() {
}
template<typename V> LIMITED_INT( const LIMITED_INT< V >& orig )
: m_Value( orig.m_Value )
{
assert(std::numeric_limits<T>::min() <= orig.m_Value);
assert(orig.m_Value <= std::numeric_limits<T>::max());
}
template<typename V> LIMITED_INT( const double v )
: m_Value( floor(v+0.5) )
{
assert(std::numeric_limits<T>::min() <= v);
assert(v <= std::numeric_limits<T>::max());
}
LIMITED_INT( T v ): m_Value( v )
{
}
......@@ -38,6 +42,7 @@ public:
{
return m_Value;
}
operator double( void ) const
{
return ( double )m_Value;
......@@ -48,11 +53,13 @@ public:
m_Value = src.m_Value;
return *this;
}
LIMITED_INT<T> & operator = ( T src )
{
m_Value = src;
return *this;
}
/*************************/
/* comparisons and tests */
/*************************/
......@@ -64,10 +71,12 @@ public:
{
return m_Value == y.m_Value;
}
bool operator == ( const T y ) const
{
return m_Value == y;
}
friend bool operator == ( const T x, const LIMITED_INT< T > &y )
{
return x == y.m_Value;
......@@ -77,10 +86,12 @@ public:
{
return m_Value != y.m_Value;
}
bool operator != ( const T y ) const
{
return m_Value != y;
}
friend bool operator != ( const T x, const LIMITED_INT< T > &y )
{
return x != y.m_Value;
......@@ -90,10 +101,12 @@ public:
{
return m_Value < y.m_Value;
}
bool operator < ( const T y ) const
{
return m_Value < y;
}
friend bool operator < ( const T x, const LIMITED_INT< T > &y )
{
return x < y.m_Value;
......@@ -103,10 +116,12 @@ public:
{
return m_Value >= y.m_Value;
}
bool operator >= ( const T y ) const
{
return m_Value >= y;
}
friend bool operator >= ( const T x, const LIMITED_INT<T> &y )
{
return x >= y.m_Value;
......@@ -116,10 +131,12 @@ public:
{
return m_Value > y.m_Value;
}
bool operator > ( const T y ) const
{
return m_Value > y;
}
friend bool operator > ( const T x, const LIMITED_INT< T > &y )
{
return x > y.m_Value;
......@@ -129,10 +146,12 @@ public:
{
return m_Value <= y.m_Value;
}
bool operator <= ( const T y ) const
{
return m_Value <= y;
}
friend bool operator <= ( const T x, const LIMITED_INT< T > &y )
{
return x <= y.m_Value;
......@@ -147,18 +166,22 @@ public:
assert( !( m_Value < 0 ) || std::numeric_limits< T >::min() - m_Value <= y.m_Value );
return m_Value + y.m_Value;
}
LIMITED_INT< T > operator + ( const T y ) const
{
return *this + LIMITED_INT< T >( y );
}
friend LIMITED_INT< T > operator + ( const T x, const LIMITED_INT< T > &y )
{
return LIMITED_INT< T >( x ) + y;
}
double operator + ( const double y ) const
{
return double( m_Value ) + y;
}
friend double operator + ( const double x, const LIMITED_INT< T > &y )
{
return x + double( y.m_Value );
......@@ -169,24 +192,29 @@ public:
assert( -std::numeric_limits< T >::max() <= m_Value );
return -m_Value;
}
LIMITED_INT< T > operator - ( const LIMITED_INT< T > &y ) const
{
assert( !( 0 < m_Value ) || m_Value - std::numeric_limits< T >::max() <= y.m_Value );
assert( !( m_Value < 0 ) || y.m_Value <= m_Value - std::numeric_limits< T >::min() );
return m_Value - y.m_Value;
}
LIMITED_INT< T > operator - ( const T y ) const
{
return *this - LIMITED_INT< T >( y );
}
friend LIMITED_INT< T > operator - ( const T x, const LIMITED_INT< T > &y )
{
return LIMITED_INT< T >( x ) - y;
}
double operator - ( const double y ) const
{
return double( m_Value ) - y;
}
friend double operator - ( const double x, const LIMITED_INT< T > &y )
{
return x - double( y.m_Value );
......@@ -204,18 +232,22 @@ public:
|| std::numeric_limits<T>::max() / m_Value <= y.m_Value );
return m_Value * y.m_Value;
}
LIMITED_INT<T> operator * ( const T y) const
{
return *this * LIMITED_INT< T >( y );
}
friend LIMITED_INT< T > operator *( const T x, const LIMITED_INT< T > &y )
{
return LIMITED_INT< T >( x ) * y;
}
double operator * ( const double y ) const
{
return double( m_Value ) * y;
}
friend double operator * ( const double x, const LIMITED_INT< T > &y )
{
return x * double( y.m_Value );
......@@ -227,18 +259,22 @@ public:
|| -std::numeric_limits< T >::max() <= m_Value );
return m_Value / y.m_Value;
}
LIMITED_INT<T> operator / ( const T y ) const
{
return *this / LIMITED_INT<T>(y);
}
friend LIMITED_INT< T > operator / ( const T x, const LIMITED_INT< T > &y )
{
return LIMITED_INT< T >( x ) / y;
}
double operator / ( const double y ) const
{
return double( m_Value ) / y;
}
friend double operator / ( const double x, const LIMITED_INT< T > &y )
{
return x / double( y.m_Value );
......@@ -248,62 +284,71 @@ public:
{
return m_Value % y.m_Value;
}
LIMITED_INT<T> operator % ( const T y ) const
{
return *this % LIMITED_INT<T>(y);
}
friend LIMITED_INT< T > operator % ( const T x, const LIMITED_INT< T > &y )
{
return LIMITED_INT< T >( x ) % y;
}
/*************************/
/* assignment arithmetic */
/*************************/
LIMITED_INT< T >& operator += ( const LIMITED_INT< T > &y )
{
*this = *this + y;
return *this;
}
LIMITED_INT< T >& operator += ( const T y )
{
*this = *this + y;
return *this;
}
LIMITED_INT< T >& operator ++ ( void )
{
*this = *this + 1;
return *this;
}
LIMITED_INT< T >& operator -= ( const LIMITED_INT< T > &y )
{
*this = *this - y;
return *this;
}
LIMITED_INT< T >& operator -= ( const T y )
{
*this = *this - y;
return *this;
}
LIMITED_INT< T >& operator -- ( void )
{
*this = *this - 1;
return *this;
}
LIMITED_INT< T >& operator *= ( const LIMITED_INT< T > &y )
{
*this = *this * y;
return *this;
}
LIMITED_INT< T >& operator *= ( const T y )
{
*this = *this * y;
return *this;
}
LIMITED_INT< T >& operator /= ( const LIMITED_INT< T > &y )
{
*this = *this / y;
return *this;
}
LIMITED_INT< T >& operator /= ( const T y )
{
*this = *this / y;
......
......@@ -550,9 +550,9 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
continue;
SETMIRROR( pad->GetPosition().x );
pad->m_Pos0.x = FROM_LEGACY_LU( pad->GetPosition().x );
NEGATE( pad->m_Offset.x );
NEGATE( pad->m_DeltaSize.x );
pad->m_Pos0.x() = FROM_LEGACY_LU( pad->GetPosition().x );
NEGATE( pad->m_Offset.x() );
NEGATE( pad->m_DeltaSize.x() );
pad->m_Orient = 1800 - pad->m_Orient;
NORMALIZE_ANGLE_POS( pad->m_Orient );
}
......
......@@ -328,8 +328,8 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( std:: vector < CPolyPt>& aCor
{
wxPoint corner_position;
int ii, angle;
int dx = TO_LEGACY_LU( m_Size.x / 2 ) + aClearanceValue;
int dy = TO_LEGACY_LU( m_Size.y / 2 ) + aClearanceValue;
int dx = TO_LEGACY_LU( m_Size.x() / 2 ) + aClearanceValue;
int dy = TO_LEGACY_LU( m_Size.y() / 2 ) + aClearanceValue;
int delta = 3600 / aCircleToSegmentsCount; // rot angle in 0.1 degree
wxPoint PadShapePos = ReturnShapePos(); /* Note: for pad having a shape offset,
......@@ -437,8 +437,8 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( std:: vector < CPolyPt>& aCor
default:
case PAD_TRAPEZOID:
psize.x += TO_LEGACY_LU( ABS( m_DeltaSize.y ) );
psize.y += TO_LEGACY_LU( ABS( m_DeltaSize.x ) );
psize.x += TO_LEGACY_LU( abs( m_DeltaSize.y() ) );
psize.y += TO_LEGACY_LU( abs( m_DeltaSize.x() ) );
// fall through
case PAD_RECT:
......@@ -572,8 +572,8 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
wxPoint PadShapePos = aPad.ReturnShapePos(); /* Note: for pad having a shape offset,
* the pad position is NOT the shape position */
wxSize copper_thickness;
int dx = TO_LEGACY_LU( aPad.m_Size.x / 2 );
int dy = TO_LEGACY_LU( aPad.m_Size.y / 2 );
int dx = TO_LEGACY_LU( aPad.m_Size.x() / 2 );
int dy = TO_LEGACY_LU( aPad.m_Size.y() / 2 );
int delta = 3600 / aCircleToSegmentsCount; // rot angle in 0.1 degree
......@@ -684,8 +684,8 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
// Oval pad support along the lines of round and rectangular pads
std::vector <wxPoint> corners_buffer; // Polygon buffer as vector
int dx = TO_LEGACY_LU( aPad.m_Size.x / 2 ) + aThermalGap; // Cutout radius x
int dy = TO_LEGACY_LU( aPad.m_Size.y / 2 ) + aThermalGap; // Cutout radius y
int dx = TO_LEGACY_LU( aPad.m_Size.x() / 2 ) + aThermalGap; // Cutout radius x
int dy = TO_LEGACY_LU( aPad.m_Size.y() / 2 ) + aThermalGap; // Cutout radius y
wxPoint shape_offset;
......@@ -839,8 +839,8 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
std::vector <wxPoint> corners_buffer; // Polygon buffer as vector
int dx = TO_LEGACY_LU( aPad.m_Size.x / 2 ) + aThermalGap; // Cutout radius x
int dy = TO_LEGACY_LU( aPad.m_Size.y / 2 ) + aThermalGap; // Cutout radius y
int dx = TO_LEGACY_LU( aPad.m_Size.x() / 2 ) + aThermalGap; // Cutout radius x
int dy = TO_LEGACY_LU( aPad.m_Size.y() / 2 ) + aThermalGap; // Cutout radius y
// The first point of polygon buffer is left lower corner, second the crosspoint of
// thermal spoke sides, the third is upper right corner and the rest are rounding
......
......@@ -186,9 +186,9 @@ void MODULE::Flip(const wxPoint& aCentre )
pt_pad->m_Pos.y -= m_Pos.y;
pt_pad->m_Pos.y = -pt_pad->m_Pos.y;
pt_pad->m_Pos.y += m_Pos.y;
NEGATE( pt_pad->m_Pos0.y );
NEGATE( pt_pad->m_Offset.y );
NEGATE( pt_pad->m_DeltaSize.y );
NEGATE( pt_pad->m_Pos0.y() );
NEGATE( pt_pad->m_Offset.y() );
NEGATE( pt_pad->m_DeltaSize.y() );
NEGATE_AND_NORMALIZE_ANGLE_POS( pt_pad->m_Orient );
/* flip pads layers*/
......@@ -352,8 +352,8 @@ void MODULE::SetOrientation( int newangle )
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
{
px = TO_LEGACY_LU( pad->m_Pos0.x );
py = TO_LEGACY_LU( pad->m_Pos0.y );
px = TO_LEGACY_LU( pad->m_Pos0.x() );
py = TO_LEGACY_LU( pad->m_Pos0.y() );
pad->m_Orient += newangle; /* change m_Orientation */
NORMALIZE_ANGLE_POS( pad->m_Orient );
......
This diff is collapsed.
......@@ -476,7 +476,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
/* Draw the pad hole */
wxPoint holepos = m_Pos - aDrawInfo.m_Offset;
int hole = TO_LEGACY_LU( m_Drill.x ) / 2;
int hole = TO_LEGACY_LU( m_Drill.x() ) / 2;
bool drawhole = hole > 0;
......@@ -513,20 +513,20 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
break;
case PAD_OVAL:
halfsize.x = TO_LEGACY_LU( m_Drill.x ) / 2;
halfsize.y = TO_LEGACY_LU( m_Drill.y ) / 2;
halfsize.x = TO_LEGACY_LU( m_Drill.x() ) / 2;
halfsize.y = TO_LEGACY_LU( m_Drill.y() ) / 2;
if( m_Drill.x > m_Drill.y ) /* horizontal */
if( m_Drill.x() > m_Drill.y() ) /* horizontal */
{
delta_cx = halfsize.x - halfsize.y;
delta_cy = 0;
seg_width = TO_LEGACY_LU( m_Drill.y );
seg_width = TO_LEGACY_LU( m_Drill.y() );
}
else /* vertical */
{
delta_cx = 0;
delta_cy = halfsize.y - halfsize.x;
seg_width = TO_LEGACY_LU( m_Drill.x );
seg_width = TO_LEGACY_LU( m_Drill.x() );
}
RotatePoint( &delta_cx, &delta_cy, angle );
......@@ -578,11 +578,11 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
AreaSize = TO_LEGACY_LU_WXS( m_Size );
if( m_Size.y > m_Size.x )
if( m_Size.y() > m_Size.x() )
{
angle += 900;
AreaSize.x = TO_LEGACY_LU( m_Size.y );
AreaSize.y = TO_LEGACY_LU( m_Size.x );
AreaSize.x = TO_LEGACY_LU( m_Size.y() );
AreaSize.y = TO_LEGACY_LU( m_Size.x() );
}
if( shortname_len > 0 ) // if there is a netname, provides room to display this netname
......@@ -664,23 +664,23 @@ int D_PAD::BuildSegmentFromOvalShape(wxPoint& aSegStart, wxPoint& aSegEnd, int a
{
int width;
if( m_Size.y < m_Size.x ) // Build an horizontal equiv segment
if( m_Size.y() < m_Size.x() ) // Build an horizontal equiv segment
{
int delta = TO_LEGACY_LU( ( m_Size.x - m_Size.y ) / 2 );
int delta = TO_LEGACY_LU( ( m_Size.x() - m_Size.y() ) / 2 );
aSegStart.x = -delta;
aSegStart.y = 0;
aSegEnd.x = delta;
aSegEnd.y = 0;
width = TO_LEGACY_LU( m_Size.y );
width = TO_LEGACY_LU( m_Size.y() );
}
else // Vertical oval: build a vertical equiv segment
{
int delta = TO_LEGACY_LU( ( m_Size.y -m_Size.x ) / 2 );
int delta = TO_LEGACY_LU( ( m_Size.y() -m_Size.x() ) / 2 );
aSegStart.x = 0;
aSegStart.y = -delta;
aSegEnd.x = 0;
aSegEnd.y = delta;
width = TO_LEGACY_LU( m_Size.x );
width = TO_LEGACY_LU( m_Size.x() );
}
if( aRotation )
......@@ -701,8 +701,8 @@ void D_PAD::BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue, int aRotat
wxSize delta;
wxSize halfsize;
halfsize.x = TO_LEGACY_LU( m_Size.x / 2 );
halfsize.y = TO_LEGACY_LU( m_Size.y / 2 );
halfsize.x = TO_LEGACY_LU( m_Size.x() / 2 );
halfsize.y = TO_LEGACY_LU( m_Size.y() / 2 );
/* For rectangular shapes, inflate is easy
*/
......@@ -721,8 +721,8 @@ void D_PAD::BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue, int aRotat
else
{
// Trapezoidal pad: verify delta values
delta.x = TO_LEGACY_LU( m_DeltaSize.x / 2 );
delta.y = TO_LEGACY_LU( m_DeltaSize.y / 2 );
delta.x = TO_LEGACY_LU( m_DeltaSize.x() / 2 );
delta.y = TO_LEGACY_LU( m_DeltaSize.y() / 2 );
// be sure delta values are not to large
if( (delta.x < 0) && (delta.x <= -halfsize.y) )
......@@ -762,7 +762,7 @@ void D_PAD::BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue, int aRotat
if( delta.y ) // lower and upper segment is horizontal
{
// Calculate angle of left (or right) segment with vertical axis
angle = atan2( m_DeltaSize.y, m_Size.y ); /// TODO: make atan2 available to LENGTH
angle = atan2( m_DeltaSize.y(), m_Size.y() );
// left and right sides are moved by aInflateValue.x in their perpendicular direction
// We must calculate the corresponding displacement on the horizontal axis
......@@ -778,7 +778,7 @@ void D_PAD::BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue, int aRotat
else if( delta.x ) // left and right segment is vertical
{
// Calculate angle of lower (or upper) segment with horizontal axis
angle = atan2( m_DeltaSize.x, m_Size.x );
angle = atan2( m_DeltaSize.x(), m_Size.x() );
// lower and upper sides are moved by aInflateValue.x in their perpendicular direction
// We must calculate the corresponding displacement on the vertical axis
......
......@@ -185,7 +185,7 @@ void DIALOG_GENDRILL::InitDisplayParams( void )
{
if( pad->m_DrillShape == PAD_CIRCLE )
{
if( pad->m_Drill.x != ZERO_LENGTH )
if( pad->m_Drill.x() != ZERO_LENGTH )
{
if( pad->m_Attribut == PAD_HOLE_NOT_PLATED )
m_notplatedPadsHoleCount++;
......@@ -195,7 +195,7 @@ void DIALOG_GENDRILL::InitDisplayParams( void )
}
else
{
if( MIN( TO_LEGACY_LU( pad->m_Drill.x ), TO_LEGACY_LU( pad->m_Drill.y ) ) != 0 )
if( min( TO_LEGACY_LU( pad->m_Drill.x() ), TO_LEGACY_LU( pad->m_Drill.y() ) ) != 0 )
{
if( pad->m_Attribut == PAD_HOLE_NOT_PLATED )
m_notplatedPadsHoleCount++;
......
This diff is collapsed.
......@@ -617,7 +617,7 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_li
/* Here, we must test clearance between holes and pads
* dummy pad size and shape is adjusted to pad drill size and shape
*/
if( pad->m_Drill.x != ZERO_LENGTH )
if( pad->m_Drill.x() != ZERO_LENGTH )
{
// pad under testing has a hole, test this hole against pad reference
dummypad.SetPosition( pad->GetPosition() );
......@@ -637,7 +637,7 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_li
}
}
if( aRefPad->m_Drill.x != ZERO_LENGTH ) // pad reference has a hole
if( aRefPad->m_Drill.x() != ZERO_LENGTH ) // pad reference has a hole
{
dummypad.SetPosition( aRefPad->GetPosition() );
dummypad.m_Size = aRefPad->m_Drill;
......
......@@ -290,7 +290,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
* checkClearanceSegmToPad(),a pseudo pad is used, with a shape and a
* size like the hole
*/
if( pad->m_Drill.x == ZERO_LENGTH )
if( pad->m_Drill.x() == ZERO_LENGTH )
continue;
dummypad.m_Size = pad->m_Drill;
......@@ -633,7 +633,7 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
m_segmEnd.x = m_segmEnd.y = 0;
m_padToTestPos = relativePadPos;
diag = checkClearanceSegmToPad( aPad, TO_LEGACY_LU( aRefPad->m_Size.x ), dist_min );
diag = checkClearanceSegmToPad( aPad, TO_LEGACY_LU( aRefPad->m_Size.x() ), dist_min );
break;
case PAD_RECT:
......@@ -664,10 +664,10 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
relativePadPos.x = ABS( relativePadPos.x );
relativePadPos.y = ABS( relativePadPos.y );
if( ( relativePadPos.x - ( (size.x + TO_LEGACY_LU( aRefPad->m_Size.x ) ) / 2 ) ) >= dist_min )
if( ( relativePadPos.x - ( (size.x + TO_LEGACY_LU( aRefPad->m_Size.x() ) ) / 2 ) ) >= dist_min )
diag = true;
if( ( relativePadPos.y - ( (size.y + TO_LEGACY_LU( aRefPad->m_Size.y) ) / 2 ) ) >= dist_min )
if( ( relativePadPos.y - ( (size.y + TO_LEGACY_LU( aRefPad->m_Size.y() ) ) / 2 ) ) >= dist_min )
diag = true;
}
else // at least one pad has any other orient. Test is more tricky
......@@ -716,15 +716,15 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
int segm_width;
m_segmAngle = aRefPad->m_Orient; // Segment orient.
if( aRefPad->m_Size.y < aRefPad->m_Size.x ) // Build an horizontal equiv segment
if( aRefPad->m_Size.y() < aRefPad->m_Size.x() ) // Build an horizontal equiv segment
{
segm_width = TO_LEGACY_LU( aRefPad->m_Size.y );
m_segmLength = TO_LEGACY_LU( aRefPad->m_Size.x - aRefPad->m_Size.y );
segm_width = TO_LEGACY_LU( aRefPad->m_Size.y() );
m_segmLength = TO_LEGACY_LU( aRefPad->m_Size.x() - aRefPad->m_Size.y() );
}
else // Vertical oval: build an horizontal equiv segment and rotate 90.0 deg
{
segm_width = TO_LEGACY_LU( aRefPad->m_Size.x );
m_segmLength = TO_LEGACY_LU( aRefPad->m_Size.y - aRefPad->m_Size.x );
segm_width = TO_LEGACY_LU( aRefPad->m_Size.x() );
m_segmLength = TO_LEGACY_LU( aRefPad->m_Size.y() - aRefPad->m_Size.x() );
m_segmAngle += 900;
}
......@@ -796,13 +796,13 @@ bool DRC::checkClearanceSegmToPad( const D_PAD* aPad, int aSegmentWidth, int aMi
int segmHalfWidth = aSegmentWidth / 2;
seuil = segmHalfWidth + aMinDist;
padHalfsize.x = TO_LEGACY_LU( aPad->m_Size.x / 2 );
padHalfsize.y = TO_LEGACY_LU( aPad->m_Size.y / 2 );
padHalfsize.x = TO_LEGACY_LU( aPad->m_Size.x() / 2 );
padHalfsize.y = TO_LEGACY_LU( aPad->m_Size.y() / 2 );
if( aPad->m_PadShape == PAD_TRAPEZOID ) // The size is bigger, due to m_DeltaSize extra size
{
padHalfsize.x += TO_LEGACY_LU( ABS(aPad->m_DeltaSize.y) / 2 ); // Remember: m_DeltaSize.y is the m_Size.x change
padHalfsize.y += TO_LEGACY_LU( ABS(aPad->m_DeltaSize.x) / 2 ); // Remember: m_DeltaSize.x is the m_Size.y change
padHalfsize.x += TO_LEGACY_LU( abs( aPad->m_DeltaSize.y() ) / 2 ); // Remember: m_DeltaSize.y is the m_Size.x change
padHalfsize.y += TO_LEGACY_LU( abs( aPad->m_DeltaSize.x() ) / 2 ); // Remember: m_DeltaSize.x is the m_Size.y change
}
if( aPad->m_PadShape == PAD_CIRCLE )
......
......@@ -82,7 +82,7 @@ void FOOTPRINT_EDIT_FRAME::Place_Ancre( MODULE* pt_mod )
for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
{
pt_pad->m_Pos0 += VECTOR_PCB( FROM_LEGACY_LU( moveVector.x ), FROM_LEGACY_LU( moveVector.y ) );
pt_pad->m_Pos0 += VECTOR_PCB::fromXY( FROM_LEGACY_LU( moveVector.x ), FROM_LEGACY_LU( moveVector.y ) );
}
/* Update the draw element coordinates. */
......
......@@ -252,70 +252,70 @@ void CreatePadsShapesSection( FILE* file, BOARD* pcb )
fprintf( file, "PAD PAD%d", pad->GetSubRatsnest() );
int dx = TO_LEGACY_LU( pad->m_Size.x / 2 );
int dy = TO_LEGACY_LU( pad->m_Size.y / 2 );
int dx = TO_LEGACY_LU( pad->m_Size.x() / 2 );
int dy = TO_LEGACY_LU( pad->m_Size.y() / 2 );
switch( pad->m_PadShape )
{
default:
case PAD_CIRCLE:
pad_type = "ROUND"; // how about oval holes?
fprintf( file, " %s %d\n", pad_type, ( int )TO_LEGACY_LU( pad->m_Drill.x ) );
fprintf( file, " %s %d\n", pad_type, ( int )TO_LEGACY_LU( pad->m_Drill.x() ) );
fprintf( file, "CIRCLE %d %d %d\n",
TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ), dx );
TO_LEGACY_LU( pad->m_Offset.x() ), -TO_LEGACY_LU( pad->m_Offset.y() ), dx );
break;
case PAD_RECT:
pad_type = "RECTANGULAR";
fprintf( file, " %s %d\n", pad_type, ( int )TO_LEGACY_LU( pad->m_Drill.x ) );
fprintf( file, " %s %d\n", pad_type, ( int )TO_LEGACY_LU( pad->m_Drill.x() ) );
fprintf( file, "RECTANGLE %d %d %d %d\n",
TO_LEGACY_LU( pad->m_Offset.x ) - dx, -TO_LEGACY_LU( pad->m_Offset.y ) - dy,
TO_LEGACY_LU( pad->m_Size.x ), TO_LEGACY_LU( pad->m_Size.y ) );
TO_LEGACY_LU( pad->m_Offset.x() ) - dx, -TO_LEGACY_LU( pad->m_Offset.y() ) - dy,
TO_LEGACY_LU( pad->m_Size.x() ), TO_LEGACY_LU( pad->m_Size.y() ) );
break;
case PAD_OVAL: /* Create outline by 2 lines and 2 arcs */
{
pad_type = "FINGER";
fprintf( file, " %s %d\n", pad_type, ( int )TO_LEGACY_LU( pad->m_Drill.x ) );
fprintf( file, " %s %d\n", pad_type, ( int )TO_LEGACY_LU( pad->m_Drill.x() ) );
int dr = dx - dy;
if( dr >= 0 ) // Horizontal oval
{
int radius = dy;
fprintf( file, "LINE %d %d %d %d\n",
-dr + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) - radius,
dr + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) - radius );
-dr + TO_LEGACY_LU( pad->m_Offset.x() ), -TO_LEGACY_LU( pad->m_Offset.y() ) - radius,
dr + TO_LEGACY_LU( pad->m_Offset.x() ), -TO_LEGACY_LU( pad->m_Offset.y() ) - radius );
fprintf( file, "ARC %d %d %d %d %d %d\n",
dr + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) - radius,
dr + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) + radius,
dr + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) );
dr + TO_LEGACY_LU( pad->m_Offset.x() ), -TO_LEGACY_LU( pad->m_Offset.y() ) - radius,
dr + TO_LEGACY_LU( pad->m_Offset.x() ), -TO_LEGACY_LU( pad->m_Offset.y() ) + radius,
dr + TO_LEGACY_LU( pad->m_Offset.x() ), -TO_LEGACY_LU( pad->m_Offset.y() ) );
fprintf( file, "LINE %d %d %d %d\n",
dr + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) + radius,
-dr + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) + radius );
dr + TO_LEGACY_LU( pad->m_Offset.x() ), -TO_LEGACY_LU( pad->m_Offset.y() ) + radius,
-dr + TO_LEGACY_LU( pad->m_Offset.x() ), -TO_LEGACY_LU( pad->m_Offset.y() ) + radius );
fprintf( file, "ARC %d %d %d %d %d %d\n",
-dr + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) + radius,
-dr + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) - radius,
-dr + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) );
-dr + TO_LEGACY_LU( pad->m_Offset.x() ), -TO_LEGACY_LU( pad->m_Offset.y() ) + radius,
-dr + TO_LEGACY_LU( pad->m_Offset.x() ), -TO_LEGACY_LU( pad->m_Offset.y() ) - radius,
-dr + TO_LEGACY_LU( pad->m_Offset.x() ), -TO_LEGACY_LU( pad->m_Offset.y() ) );
}
else // Vertical oval
{
dr = -dr;
int radius = dx;
fprintf( file, "LINE %d %d %d %d\n",
-radius + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) - dr,
-radius + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) + dr );
-radius + TO_LEGACY_LU( pad->m_Offset.x() ), -TO_LEGACY_LU( pad->m_Offset.y() ) - dr,
-radius + TO_LEGACY_LU( pad->m_Offset.x() ), -TO_LEGACY_LU( pad->m_Offset.y() ) + dr );
fprintf( file, "ARC %d %d %d %d %d %d\n",
-radius + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) + dr,
radius + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) + dr,
TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) + dr );
-radius + TO_LEGACY_LU( pad->m_Offset.x() ), -TO_LEGACY_LU( pad->m_Offset.y() ) + dr,
radius + TO_LEGACY_LU( pad->m_Offset.x() ), -TO_LEGACY_LU( pad->m_Offset.y() ) + dr,
TO_LEGACY_LU( pad->m_Offset.x() ), -TO_LEGACY_LU( pad->m_Offset.y() ) + dr );
fprintf( file, "LINE %d %d %d %d\n",
radius + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) + dr,
radius + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) - dr );
radius + TO_LEGACY_LU( pad->m_Offset.x() ), -TO_LEGACY_LU( pad->m_Offset.y() ) + dr,
radius + TO_LEGACY_LU( pad->m_Offset.x() ), -TO_LEGACY_LU( pad->m_Offset.y() ) - dr );
fprintf( file, "ARC %d %d %d %d %d %d\n",
radius + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) - dr,
-radius + TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) - dr,
TO_LEGACY_LU( pad->m_Offset.x ), -TO_LEGACY_LU( pad->m_Offset.y ) - dr );
radius + TO_LEGACY_LU( pad->m_Offset.x() ), -TO_LEGACY_LU( pad->m_Offset.y() ) - dr,
-radius + TO_LEGACY_LU( pad->m_Offset.x() ), -TO_LEGACY_LU( pad->m_Offset.y() ) - dr,
TO_LEGACY_LU( pad->m_Offset.x() ), -TO_LEGACY_LU( pad->m_Offset.y() ) - dr );
}
break;
}
......@@ -410,7 +410,7 @@ void CreateShapesSection( FILE* file, BOARD* pcb )
NORMALIZE_ANGLE_POS( orient );
fprintf( file, "PIN %s PAD%d %d %d %s %d %s",
TO_UTF8( pinname ), pad->GetSubRatsnest(),
TO_LEGACY_LU( pad->m_Pos0.x ), TO_LEGACY_LU( -pad->m_Pos0.y ),
TO_LEGACY_LU( pad->m_Pos0.x() ), TO_LEGACY_LU( -pad->m_Pos0.y() ),
layer, orient / 10, mirror );
if( orient % 10 )
......
......@@ -881,8 +881,8 @@ static void export_vrml_edge_module( EDGE_MODULE* module ) /*{{{*/
static void export_vrml_pad( BOARD* pcb, D_PAD* pad ) /*{{{*/
{
double hole_drill_w = (double) TO_LEGACY_LU_DBL( pad->m_Drill.x / 2 );
double hole_drill_h = (double) TO_LEGACY_LU_DBL( pad->m_Drill.y / 2 );
double hole_drill_w = (double) TO_LEGACY_LU_DBL( pad->m_Drill.x() / 2 );
double hole_drill_h = (double) TO_LEGACY_LU_DBL( pad->m_Drill.y() / 2 );
double hole_drill = MIN( hole_drill_w, hole_drill_h );
double hole_x = pad->m_Pos.x;
double hole_y = pad->m_Pos.y;
......@@ -916,8 +916,8 @@ static void export_vrml_pad( BOARD* pcb, D_PAD* pad ) /*{{{*/
wxSize pad_delta = TO_LEGACY_LU_WXS( pad->m_DeltaSize );
double pad_dx = pad_delta.x / 2;
double pad_dy = pad_delta.y / 2;
double pad_w = TO_LEGACY_LU_DBL( pad->m_Size.x / 2 );
double pad_h = TO_LEGACY_LU_DBL( pad->m_Size.y / 2 );
double pad_w = TO_LEGACY_LU_DBL( pad->m_Size.x() / 2 );
double pad_h = TO_LEGACY_LU_DBL( pad->m_Size.y() / 2 );
for( int layer = FIRST_COPPER_LAYER; layer < copper_layers; layer++ )
{
......
......@@ -127,21 +127,21 @@ void Build_Holes_List( BOARD* aPcb,
if( aGenerateNPTH_list && pad->m_Attribut != PAD_HOLE_NOT_PLATED )
continue;
if( pad->m_Drill.x == ZERO_LENGTH )
if( pad->m_Drill.x() == ZERO_LENGTH )
continue;
new_hole.m_Hole_NotPlated = (pad->m_Attribut == PAD_HOLE_NOT_PLATED);
new_hole.m_Tool_Reference = -1; // Flag is: Not initialized
new_hole.m_Hole_Orient = pad->m_Orient;
new_hole.m_Hole_Shape = 0; // hole shape: round
new_hole.m_Hole_Diameter = min( TO_LEGACY_LU( pad->m_Drill.x ), TO_LEGACY_LU( pad->m_Drill.y ) );
new_hole.m_Hole_Diameter = min( TO_LEGACY_LU( pad->m_Drill.x() ), TO_LEGACY_LU( pad->m_Drill.y() ) );
new_hole.m_Hole_Size.x = new_hole.m_Hole_Size.y = new_hole.m_Hole_Diameter;
if( pad->m_DrillShape != PAD_CIRCLE )
new_hole.m_Hole_Shape = 1; // oval flag set
new_hole.m_Hole_Size.x = TO_LEGACY_LU( pad->m_Drill.x );
new_hole.m_Hole_Size.y = TO_LEGACY_LU( pad->m_Drill.y );
new_hole.m_Hole_Size.x = TO_LEGACY_LU( pad->m_Drill.x() );
new_hole.m_Hole_Size.y = TO_LEGACY_LU( pad->m_Drill.y() );
new_hole.m_Hole_Pos = pad->m_Pos; // hole position
new_hole.m_Hole_Bottom_Layer = LAYER_N_BACK;
new_hole.m_Hole_Top_Layer = LAYER_N_FRONT;// pad holes are through holes
......
......@@ -438,19 +438,20 @@ void PCB_EDIT_FRAME::GenModuleReport( wxCommandEvent& event )
{
fprintf( rptfile, "$PAD \"%.4s\"\n", pad->m_Padname );
sprintf( line, "position %9.6f %9.6f\n",
TO_LEGACY_LU_DBL( pad->m_Pos0.x ) * conv_unit,
TO_LEGACY_LU_DBL( pad->m_Pos0.y ) * conv_unit );
TO_LEGACY_LU_DBL( pad->m_Pos0.x() ) * conv_unit,
TO_LEGACY_LU_DBL( pad->m_Pos0.y() ) * conv_unit );
fputs( line, rptfile );
sprintf( line, "size %9.6f %9.6f\n",
TO_LEGACY_LU_DBL( pad->m_Size.x ) * conv_unit,
TO_LEGACY_LU_DBL( pad->m_Size.y ) * conv_unit );
TO_LEGACY_LU_DBL( pad->m_Size.x() ) * conv_unit,
TO_LEGACY_LU_DBL( pad->m_Size.y() ) * conv_unit );
fputs( line, rptfile );
sprintf( line, "drill %9.6f\n", TO_LEGACY_LU_DBL( pad->m_Drill.x ) * conv_unit );
sprintf( line, "drill %9.6f\n",
TO_LEGACY_LU_DBL( pad->m_Drill.x() ) * conv_unit );
fputs( line, rptfile );
sprintf( line, "shape_offset %9.6f %9.6f\n",
TO_LEGACY_LU_DBL( pad->m_Offset.x ) * conv_unit,
TO_LEGACY_LU_DBL( pad->m_Offset.y ) * conv_unit );
TO_LEGACY_LU_DBL( pad->m_Offset.x() ) * conv_unit,
TO_LEGACY_LU_DBL( pad->m_Offset.y() ) * conv_unit );
fputs( line, rptfile );
sprintf( line, "orientation %.2f\n",
......
......@@ -254,19 +254,19 @@ void PCB_BASE_FRAME::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw )
if( pt_pad->m_PadShape != PAD_TRAPEZOID )
{
pt_pad->m_DeltaSize.x = ZERO_LENGTH;
pt_pad->m_DeltaSize.y = ZERO_LENGTH;
pt_pad->m_DeltaSize.x() = ZERO_LENGTH;
pt_pad->m_DeltaSize.y() = ZERO_LENGTH;
}
if( pt_pad->m_PadShape == PAD_CIRCLE )
pt_pad->m_Size.y = pt_pad->m_Size.x;
pt_pad->m_Size.y() = pt_pad->m_Size.x();
switch( pt_pad->m_Attribut & 0x7F )
{
case PAD_SMD:
case PAD_CONN:
pt_pad->m_Drill = VECTOR_PCB(ZERO_LENGTH, ZERO_LENGTH);//wxSize( 0, 0 );
pt_pad->m_Offset.x = ZERO_LENGTH;
pt_pad->m_Offset.y = ZERO_LENGTH;
pt_pad->m_Drill = VECTOR_PCB::fromXY(ZERO_LENGTH, ZERO_LENGTH);//wxSize( 0, 0 );
pt_pad->m_Offset.x() = ZERO_LENGTH;
pt_pad->m_Offset.y() = ZERO_LENGTH;
break;
default:
......
......@@ -371,14 +371,14 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
}
Pad->m_Pos.x = (ibuf[0] + ibuf[2]) / 2;
Pad->m_Pos.y = (ibuf[1] + ibuf[3]) / 2;
Pad->m_Size.x = FROM_LEGACY_LU( ibuf[4] + abs( ibuf[0] - ibuf[2] ) );
Pad->m_Size.y = FROM_LEGACY_LU( ibuf[4] + abs( ibuf[1] - ibuf[3] ) );
Pad->m_Size.x() = FROM_LEGACY_LU( ibuf[4] + abs( ibuf[0] - ibuf[2] ) );
Pad->m_Size.y() = FROM_LEGACY_LU( ibuf[4] + abs( ibuf[1] - ibuf[3] ) );
Pad->m_Pos.x += m_Pos.x;
Pad->m_Pos.y += m_Pos.y;
if( !TestFlags( params[iflgidx], 0x0100, wxT( "square" ) ) )
{
if( Pad->m_Size.x == Pad->m_Size.y )
if( Pad->m_Size.x() == Pad->m_Size.y() )
Pad->m_PadShape = PAD_ROUND;
else
Pad->m_PadShape = PAD_OVAL;
......@@ -430,12 +430,13 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
Pad->m_Pos.x = ibuf[0];
Pad->m_Pos.y = ibuf[1];
Pad->m_Drill.x = Pad->m_Drill.y = FROM_LEGACY_LU( (int) ibuf[5] );
Pad->m_Size.x = Pad->m_Size.y = FROM_LEGACY_LU( ibuf[3] ) + Pad->m_Drill.x;
Pad->m_Drill.x() = Pad->m_Drill.y() = FROM_LEGACY_LU( (int) ibuf[5] );
Pad->m_Size.x() = Pad->m_Size.y() =
FROM_LEGACY_LU( ibuf[3] ) + Pad->m_Drill.x();
Pad->m_Pos.x += m_Pos.x;
Pad->m_Pos.y += m_Pos.y;
if( (Pad->m_PadShape == PAD_ROUND) && (Pad->m_Size.x != Pad->m_Size.y) )
if( (Pad->m_PadShape == PAD_ROUND) && (Pad->m_Size.x() != Pad->m_Size.y()) )
Pad->m_PadShape = PAD_OVAL;
m_Pads.PushBack( Pad );
......
......@@ -89,7 +89,7 @@ void PlacePad( BOARD* Pcb, D_PAD* pt_pad, int color, int marge, int op_logic )
int dx, dy;
wxPoint shape_pos = pt_pad->ReturnShapePos();
dx = TO_LEGACY_LU( pt_pad->m_Size.x / 2 );
dx = TO_LEGACY_LU( pt_pad->m_Size.x() / 2 );
dx += marge;
if( pt_pad->m_PadShape == PAD_CIRCLE )
......@@ -100,13 +100,13 @@ void PlacePad( BOARD* Pcb, D_PAD* pt_pad, int color, int marge, int op_logic )
}
dy = TO_LEGACY_LU( pt_pad->m_Size.y / 2 );
dy = TO_LEGACY_LU( pt_pad->m_Size.y() / 2 );
dy += marge;
if( pt_pad->m_PadShape == PAD_TRAPEZOID )
{
dx += TO_LEGACY_LU( ABS( pt_pad->m_DeltaSize.y ) / 2 );
dy += TO_LEGACY_LU( ABS( pt_pad->m_DeltaSize.x ) / 2 );
dx += TO_LEGACY_LU( abs( pt_pad->m_DeltaSize.y() ) / 2 );
dy += TO_LEGACY_LU( abs( pt_pad->m_DeltaSize.x() ) / 2 );
}
if( ( pt_pad->m_Orient % 900 ) == 0 ) /* The pad is a rectangle
......
......@@ -586,16 +586,16 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
if( stricmp( line, "PadSize" ) == 0 )
{
g_Pad_Master.m_Size.x = LENGTH_LOAD_STR( data );
g_Pad_Master.m_Size.x() = LENGTH_LOAD_STR( data );
data = strtok( NULL, delims );
g_Pad_Master.m_Size.y = LENGTH_LOAD_STR( data );
g_Pad_Master.m_Size.y() = LENGTH_LOAD_STR( data );
continue;
}
if( stricmp( line, "PadDrill" ) == 0 )
{
g_Pad_Master.m_Drill.x = LENGTH_LOAD_STR( data );
g_Pad_Master.m_Drill.y = g_Pad_Master.m_Drill.x;
g_Pad_Master.m_Drill.x() = LENGTH_LOAD_STR( data );
g_Pad_Master.m_Drill.y() = g_Pad_Master.m_Drill.x();
continue;
}
......@@ -757,8 +757,8 @@ static int WriteSetup( FILE* aFile, PCB_EDIT_FRAME* aFrame, BOARD* aBoard )
fprintf( aFile, "EdgeModWidth %d\n", g_ModuleSegmentWidth );
fprintf( aFile, "TextModSize %d %d\n", g_ModuleTextSize.x, g_ModuleTextSize.y );
fprintf( aFile, "TextModWidth %d\n", g_ModuleTextWidth );
fprintf( aFile, "PadSize "FM_LENSV" "FM_LENSV"\n", ARG_LENSV( g_Pad_Master.m_Size.x ), ARG_LENSV( g_Pad_Master.m_Size.y ) );
fprintf( aFile, "PadDrill "FM_LENSV"\n", ARG_LENSV( g_Pad_Master.m_Drill.x ) );
fprintf( aFile, "PadSize "FM_LENSV" "FM_LENSV"\n", ARG_LENSV( g_Pad_Master.m_Size.x() ), ARG_LENSV( g_Pad_Master.m_Size.y() ) );
fprintf( aFile, "PadDrill "FM_LENSV"\n", ARG_LENSV( g_Pad_Master.m_Drill.x() ) );
fprintf( aFile,
"Pad2MaskClearance %d\n",
aBoard->GetBoardDesignSettings()->m_SolderMaskMargin );
......
......@@ -711,15 +711,15 @@ void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform )
pad->m_Pos0 = FROM_LEGACY_LU_VEC( pad->m_Pos );
pad->m_Orient -= angle;
wxPoint of;
of.x = TO_LEGACY_LU( pad->m_Offset.x );
of.y = TO_LEGACY_LU( pad->m_Offset.y );
of.x = TO_LEGACY_LU( pad->m_Offset.x() );
of.y = TO_LEGACY_LU( pad->m_Offset.y() );
RotatePoint( &of.x, &of.y, angle );
pad->m_Offset.x = FROM_LEGACY_LU( of.x );
pad->m_Offset.y = FROM_LEGACY_LU( of.y );
EXCHG( pad->m_Size.x, pad->m_Size.y );
pad->m_Offset.x() = FROM_LEGACY_LU( of.x );
pad->m_Offset.y() = FROM_LEGACY_LU( of.y );
EXCHG( pad->m_Size.x(), pad->m_Size.y() );
wxSize delta = TO_LEGACY_LU_WXS( pad->m_DeltaSize );
RotatePoint( &delta.x, &delta.y, -angle );
pad->m_DeltaSize = VECTOR_PCB( FROM_LEGACY_LU( delta.x ), FROM_LEGACY_LU( delta.y ) );
pad->m_DeltaSize = VECTOR_PCB::fromXY( FROM_LEGACY_LU( delta.x ), FROM_LEGACY_LU( delta.y ) );
}
module->m_Reference->m_Pos0 = module->m_Reference->m_Pos;
......@@ -757,9 +757,9 @@ void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform )
for( ; pad != NULL; pad = (D_PAD*) pad->Next() )
{
NEGATE( pad->m_Pos.y );
NEGATE( pad->m_Pos0.y );
NEGATE( pad->m_Offset.y );
NEGATE( pad->m_DeltaSize.y );
NEGATE( pad->m_Pos0.y() );
NEGATE( pad->m_Offset.y() );
NEGATE( pad->m_DeltaSize.y() );
if( pad->m_Orient )
pad->m_Orient = 3600 - pad->m_Orient;
......
......@@ -148,7 +148,7 @@ void PCB_BASE_FRAME::Import_Pad_Settings( D_PAD* aPad, bool aDraw )
aPad->m_Orient = g_Pad_Master.m_Orient +
( (MODULE*) aPad->GetParent() )->m_Orient;
aPad->m_Size = g_Pad_Master.m_Size;
aPad->m_DeltaSize = VECTOR_PCB( ZERO_LENGTH, ZERO_LENGTH );//wxSize( 0, 0 );
aPad->m_DeltaSize = VECTOR_PCB::fromXY( ZERO_LENGTH, ZERO_LENGTH );//wxSize( 0, 0 );
aPad->m_Offset = g_Pad_Master.m_Offset;
aPad->m_Drill = g_Pad_Master.m_Drill;
aPad->m_DrillShape = g_Pad_Master.m_DrillShape;
......@@ -160,7 +160,7 @@ void PCB_BASE_FRAME::Import_Pad_Settings( D_PAD* aPad, bool aDraw )
break;
case PAD_CIRCLE:
aPad->m_Size.y = aPad->m_Size.x;
aPad->m_Size.y() = aPad->m_Size.x();
break;
}
......@@ -168,8 +168,8 @@ void PCB_BASE_FRAME::Import_Pad_Settings( D_PAD* aPad, bool aDraw )
{
case PAD_SMD:
case PAD_CONN:
aPad->m_Drill = VECTOR_PCB( ZERO_LENGTH, ZERO_LENGTH ); //wxSize( 0, 0 );
aPad->m_Offset = VECTOR_PCB( ZERO_LENGTH, ZERO_LENGTH );
aPad->m_Drill = VECTOR_PCB::fromXY( ZERO_LENGTH, ZERO_LENGTH ); //wxSize( 0, 0 );
aPad->m_Offset = VECTOR_PCB::fromXY( ZERO_LENGTH, ZERO_LENGTH );
}
aPad->ComputeShapeMaxRadius();
......@@ -366,8 +366,8 @@ void PCB_BASE_FRAME::PlacePad( D_PAD* Pad, wxDC* DC )
dY = Pad->m_Pos.y - Pad_OldPos.y;
RotatePoint( &dX, &dY, -Module->m_Orient );
Pad->m_Pos0.x += FROM_LEGACY_LU( dX );
s_CurrentSelectedPad->m_Pos0.y += FROM_LEGACY_LU( dY ); /// @BUG???
Pad->m_Pos0.x() += FROM_LEGACY_LU( dX );
s_CurrentSelectedPad->m_Pos0.y() += FROM_LEGACY_LU( dY ); /// @BUG???
Pad->m_Flags = 0;
......@@ -402,13 +402,13 @@ void PCB_BASE_FRAME::RotatePad( D_PAD* Pad, wxDC* DC )
if( DC )
Module->Draw( DrawPanel, DC, GR_XOR );
EXCHG( Pad->m_Size.x, Pad->m_Size.y );
EXCHG( Pad->m_Drill.x, Pad->m_Drill.y );
EXCHG( Pad->m_Offset.x, Pad->m_Offset.y );
Pad->m_Offset.y = -Pad->m_Offset.y;
EXCHG( Pad->m_Size.x(), Pad->m_Size.y() );
EXCHG( Pad->m_Drill.x(), Pad->m_Drill.y() );
EXCHG( Pad->m_Offset.x(), Pad->m_Offset.y() );
Pad->m_Offset.y() = -Pad->m_Offset.y();
EXCHG( Pad->m_DeltaSize.x, Pad->m_DeltaSize.y );
Pad->m_DeltaSize.x = -Pad->m_DeltaSize.x;
EXCHG( Pad->m_DeltaSize.x(), Pad->m_DeltaSize.y() );
Pad->m_DeltaSize.x() = -Pad->m_DeltaSize.x();
Module->CalculateBoundingBox();
Pad->DisplayInfo( this );
......
......@@ -262,7 +262,7 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC )
PtPad->SetPadName( wxT( "1" ) );
PtPad->m_Pos = Mself.m_End;
PtPad->m_Pos0 = FROM_LEGACY_LU_VEC( PtPad->m_Pos - Module->m_Pos );
PtPad->m_Size.x = PtPad->m_Size.y = FROM_LEGACY_LU( Mself.m_Width );
PtPad->m_Size.x() = PtPad->m_Size.y() = FROM_LEGACY_LU( Mself.m_Width );
PtPad->m_layerMask = g_TabOneLayerMask[Module->GetLayer()];
PtPad->m_Attribut = PAD_SMD;
PtPad->m_PadShape = PAD_CIRCLE;
......@@ -552,7 +552,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveBasicShape( const wxString& name, int pad_c
Module->m_Pads.PushFront( pad );
pad->m_Size.x = pad->m_Size.y = FROM_LEGACY_LU( GetBoard()->GetCurrentTrackWidth() );
pad->m_Size.x() = pad->m_Size.y() = FROM_LEGACY_LU( GetBoard()->GetCurrentTrackWidth() );
pad->m_Pos = Module->m_Pos;
pad->m_PadShape = PAD_RECT;
pad->m_Attribut = PAD_SMD;
......@@ -656,19 +656,19 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
switch( shape_type )
{
case 0: //Gap :
pad->m_Pos0.x = FROM_LEGACY_LU( oX = -( gap_size + TO_LEGACY_LU( pad->m_Size.x ) ) / 2 );
pad->m_Pos.x += TO_LEGACY_LU( pad->m_Pos0.x );
pad->m_Pos0.x() = FROM_LEGACY_LU( oX = -( gap_size + TO_LEGACY_LU( pad->m_Size.x() ) ) / 2 );
pad->m_Pos.x += TO_LEGACY_LU( pad->m_Pos0.x() );
pad = pad->Next();
pad->m_Pos0.x = FROM_LEGACY_LU( oX + gap_size + TO_LEGACY_LU( pad->m_Size.x ) );
pad->m_Pos.x += TO_LEGACY_LU( pad->m_Pos0.x );
pad->m_Pos0.x() = FROM_LEGACY_LU( oX + gap_size + TO_LEGACY_LU( pad->m_Size.x() ) );
pad->m_Pos.x += TO_LEGACY_LU( pad->m_Pos0.x() );
break;
case 1: //Stub :
pad->SetPadName( wxT( "1" ) );
pad = pad->Next();
pad->m_Pos0.y = FROM_LEGACY_LU( -( gap_size + TO_LEGACY_LU( pad->m_Size.y ) ) / 2 );
pad->m_Size.y = FROM_LEGACY_LU( gap_size );
pad->m_Pos.y += TO_LEGACY_LU( pad->m_Pos0.y );
pad->m_Pos0.y() = FROM_LEGACY_LU( -( gap_size + TO_LEGACY_LU( pad->m_Size.y() ) ) / 2 );
pad->m_Size.y() = FROM_LEGACY_LU( gap_size );
pad->m_Pos.y += TO_LEGACY_LU( pad->m_Pos0.y() );
break;
case 2: // Arc Stub created by a polygonal approach:
......@@ -683,7 +683,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
std::vector<wxPoint> polyPoints = edge->GetPolyPoints();
polyPoints.reserve( numPoints );
edge->m_Start0.y = TO_LEGACY_LU( -pad->m_Size.y / 2 );
edge->m_Start0.y = TO_LEGACY_LU( -pad->m_Size.y() / 2 );
polyPoints.push_back( wxPoint( 0, 0 ) );
......@@ -968,12 +968,12 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape()
Module = Create_MuWaveBasicShape( cmp_name, pad_count );
pad1 = Module->m_Pads;
pad1->m_Pos0.x = FROM_LEGACY_LU( -ShapeSize.x / 2 );
pad1->m_Pos.x += TO_LEGACY_LU( pad1->m_Pos0.x );
pad1->m_Pos0.x() = FROM_LEGACY_LU( -ShapeSize.x / 2 );
pad1->m_Pos.x += TO_LEGACY_LU( pad1->m_Pos0.x() );
pad2 = (D_PAD*) pad1->Next();
pad2->m_Pos0.x = pad1->m_Pos0.x + FROM_LEGACY_LU( ShapeSize.x );
pad2->m_Pos.x += TO_LEGACY_LU( pad2->m_Pos0.x );
pad2->m_Pos0.x() = pad1->m_Pos0.x() + FROM_LEGACY_LU( ShapeSize.x );
pad2->m_Pos.x += TO_LEGACY_LU( pad2->m_Pos0.x() );
edge = new EDGE_MODULE( Module );
......@@ -987,13 +987,13 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape()
polyPoints.reserve( 2 * PolyEdges.size() + 2 );
// Init start point coord:
polyPoints.push_back( wxPoint( TO_LEGACY_LU( pad1->m_Pos0.x ), 0 ) );
polyPoints.push_back( wxPoint( TO_LEGACY_LU( pad1->m_Pos0.x() ), 0 ) );
wxPoint first_coordinate, last_coordinate;
for( ii = 0; ii < PolyEdges.size(); ii++ ) // Copy points
{
last_coordinate.x = wxRound( PolyEdges[ii] * ShapeScaleX ) + TO_LEGACY_LU( pad1->m_Pos0.x );
last_coordinate.x = wxRound( PolyEdges[ii] * ShapeScaleX ) + TO_LEGACY_LU( pad1->m_Pos0.x() );
last_coordinate.y = -wxRound( PolyEdges[ii] * ShapeScaleY );
polyPoints.push_back( last_coordinate );
}
......@@ -1005,15 +1005,15 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape()
case 0: // Single
case 2: // Single mirrored
// Init end point coord:
pad2->m_Pos0.x = FROM_LEGACY_LU( last_coordinate.x );
pad2->m_Pos0.x() = FROM_LEGACY_LU( last_coordinate.x );
polyPoints.push_back( wxPoint( last_coordinate.x, 0 ) );
pad1->m_Size.x = pad1->m_Size.y = FROM_LEGACY_LU( ABS( first_coordinate.y ) );
pad2->m_Size.x = pad2->m_Size.y = FROM_LEGACY_LU( ABS( last_coordinate.y ) );
pad1->m_Pos0.y = FROM_LEGACY_LU( first_coordinate.y / 2 );
pad2->m_Pos0.y = FROM_LEGACY_LU( last_coordinate.y / 2 );
pad1->m_Pos.y = TO_LEGACY_LU( pad1->m_Pos0.y ) + Module->m_Pos.y;
pad2->m_Pos.y = TO_LEGACY_LU( pad2->m_Pos0.y ) + Module->m_Pos.y;
pad1->m_Size.x() = pad1->m_Size.y() = FROM_LEGACY_LU( abs( first_coordinate.y ) );
pad2->m_Size.x() = pad2->m_Size.y() = FROM_LEGACY_LU( abs( last_coordinate.y ) );
pad1->m_Pos0.y() = FROM_LEGACY_LU( first_coordinate.y / 2 );
pad2->m_Pos0.y() = FROM_LEGACY_LU( last_coordinate.y / 2 );
pad1->m_Pos.y = TO_LEGACY_LU( pad1->m_Pos0.y() ) + Module->m_Pos.y;
pad2->m_Pos.y = TO_LEGACY_LU( pad2->m_Pos0.y() ) + Module->m_Pos.y;
break;
case 1: // Symmetric
......@@ -1026,8 +1026,8 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape()
polyPoints.push_back( pt );
}
pad1->m_Size.x = pad1->m_Size.y = FROM_LEGACY_LU( 2 * ABS( first_coordinate.y ) );
pad2->m_Size.x = pad2->m_Size.y = FROM_LEGACY_LU( 2 * ABS( last_coordinate.y ) );
pad1->m_Size.x() = pad1->m_Size.y() = FROM_LEGACY_LU( 2 * abs( first_coordinate.y ) );
pad2->m_Size.x() = pad2->m_Size.y() = FROM_LEGACY_LU( 2 * abs( last_coordinate.y ) );
break;
}
......@@ -1073,7 +1073,7 @@ void PCB_EDIT_FRAME::Edit_Gap( wxDC* DC, MODULE* Module )
Module->Draw( DrawPanel, DC, GR_XOR );
/* Calculate the current dimension. */
gap_size = TO_LEGACY_LU( next_pad->m_Pos0.x - pad->m_Pos0.x - pad->m_Size.x );
gap_size = TO_LEGACY_LU( next_pad->m_Pos0.x() - pad->m_Pos0.x() - pad->m_Size.x() );
/* Entrer the desired length of the gap. */
msg = ReturnStringFromValue( g_UserUnit, gap_size, GetScreen()->GetInternalUnits() );
......@@ -1086,19 +1086,19 @@ void PCB_EDIT_FRAME::Edit_Gap( wxDC* DC, MODULE* Module )
gap_size = ReturnValueFromString( g_UserUnit, msg, GetScreen()->GetInternalUnits() );
/* Updating sizes of pads forming the gap. */
pad->m_Size.x = pad->m_Size.y = FROM_LEGACY_LU( GetBoard()->GetCurrentTrackWidth() );
pad->m_Pos0.y = ZERO_LENGTH;
pad->m_Pos0.x = FROM_LEGACY_LU( oX = -( ( gap_size + TO_LEGACY_LU( pad->m_Size.x ) ) / 2 ) );
pad->m_Pos.x = TO_LEGACY_LU( pad->m_Pos0.x ) + Module->m_Pos.x;
pad->m_Pos.y = TO_LEGACY_LU( pad->m_Pos0.y ) + Module->m_Pos.y;
pad->m_Size.x() = pad->m_Size.y() = FROM_LEGACY_LU( GetBoard()->GetCurrentTrackWidth() );
pad->m_Pos0.y() = ZERO_LENGTH;
pad->m_Pos0.x() = FROM_LEGACY_LU( oX = -( ( gap_size + TO_LEGACY_LU( pad->m_Size.x() ) ) / 2 ) );
pad->m_Pos.x = TO_LEGACY_LU( pad->m_Pos0.x() ) + Module->m_Pos.x;
pad->m_Pos.y = TO_LEGACY_LU( pad->m_Pos0.y() ) + Module->m_Pos.y;
RotatePoint( &pad->m_Pos.x, &pad->m_Pos.y,
Module->m_Pos.x, Module->m_Pos.y, Module->m_Orient );
next_pad->m_Size.x = next_pad->m_Size.y = FROM_LEGACY_LU( GetBoard()->GetCurrentTrackWidth() );
next_pad->m_Pos0.y = ZERO_LENGTH;
next_pad->m_Pos0.x = FROM_LEGACY_LU( oX + gap_size + TO_LEGACY_LU( next_pad->m_Size.x ) );
next_pad->m_Pos.x = TO_LEGACY_LU( next_pad->m_Pos0.x ) + Module->m_Pos.x;
next_pad->m_Pos.y = TO_LEGACY_LU( next_pad->m_Pos0.y ) + Module->m_Pos.y;
next_pad->m_Size.x() = next_pad->m_Size.y() = FROM_LEGACY_LU( GetBoard()->GetCurrentTrackWidth() );
next_pad->m_Pos0.y() = ZERO_LENGTH;
next_pad->m_Pos0.x() = FROM_LEGACY_LU( oX + gap_size + TO_LEGACY_LU( next_pad->m_Size.x() ) );
next_pad->m_Pos.x = TO_LEGACY_LU( next_pad->m_Pos0.x() ) + Module->m_Pos.x;
next_pad->m_Pos.y = TO_LEGACY_LU( next_pad->m_Pos0.y() ) + Module->m_Pos.y;
RotatePoint( &next_pad->m_Pos.x, &next_pad->m_Pos.y,
Module->m_Pos.x, Module->m_Pos.y, Module->m_Orient );
......
......@@ -97,7 +97,7 @@ void PCB_BASE_FRAME::PlotSilkScreen( PLOTTER* plotter, int aLayerMask, GRTraceMo
switch( pad->m_PadShape & 0x7F )
{
case PAD_CIRCLE:
plotter->flash_pad_circle( shape_pos, TO_LEGACY_LU( pad->m_Size.x ), FILAIRE );
plotter->flash_pad_circle( shape_pos, TO_LEGACY_LU( pad->m_Size.x() ), FILAIRE );
break;
case PAD_OVAL:
......@@ -840,8 +840,8 @@ void PCB_BASE_FRAME::Plot_Standard_Layer( PLOTTER* aPlotter,
break;
}
size.x = TO_LEGACY_LU( pad->m_Size.x ) + ( 2 * margin.x );
size.y = TO_LEGACY_LU( pad->m_Size.y ) + ( 2 * margin.y );
size.x = TO_LEGACY_LU( pad->m_Size.x() ) + ( 2 * margin.x );
size.y = TO_LEGACY_LU( pad->m_Size.y() ) + ( 2 * margin.y );
/* Don't draw a null size item : */
if( size.x <= 0 || size.y <= 0 )
......@@ -851,8 +851,8 @@ void PCB_BASE_FRAME::Plot_Standard_Layer( PLOTTER* aPlotter,
{
case PAD_CIRCLE:
if( aSkipNPTH_Pads &&
( pad->m_Size.x == pad->m_Drill.x ) &&
( pad->m_Size.y == pad->m_Drill.y ) &&
( pad->m_Size.x() == pad->m_Drill.x() ) &&
( pad->m_Size.y() == pad->m_Drill.y() ) &&
(pad->m_Attribut == PAD_HOLE_NOT_PLATED) )
break;
......@@ -861,8 +861,8 @@ void PCB_BASE_FRAME::Plot_Standard_Layer( PLOTTER* aPlotter,
case PAD_OVAL:
if( aSkipNPTH_Pads &&
(pad->m_Size.x == pad->m_Drill.x ) &&
(pad->m_Size.y == pad->m_Drill.y ) &&
(pad->m_Size.x() == pad->m_Drill.x() ) &&
(pad->m_Size.y() == pad->m_Drill.y() ) &&
(pad->m_Attribut == PAD_HOLE_NOT_PLATED) )
break;
......@@ -1018,7 +1018,7 @@ void PCB_BASE_FRAME::PlotDrillMark( PLOTTER* aPlotter,
{
for( PtPad = Module->m_Pads; PtPad != NULL; PtPad = PtPad->Next() )
{
if( PtPad->m_Drill.x == ZERO_LENGTH )
if( PtPad->m_Drill.x() == ZERO_LENGTH )
continue;
// Output hole shapes:
......@@ -1026,13 +1026,13 @@ void PCB_BASE_FRAME::PlotDrillMark( PLOTTER* aPlotter,
if( PtPad->m_DrillShape == PAD_OVAL )
{
diam.x = TO_LEGACY_LU( PtPad->m_Drill.x );
diam.y = TO_LEGACY_LU( PtPad->m_Drill.y );
diam.x = TO_LEGACY_LU( PtPad->m_Drill.x() );
diam.y = TO_LEGACY_LU( PtPad->m_Drill.y() );
aPlotter->flash_pad_oval( pos, diam, PtPad->m_Orient, aTraceMode );
}
else
{
diam.x = aSmallDrillShape ? SMALL_DRILL : TO_LEGACY_LU( PtPad->m_Drill.x );
diam.x = aSmallDrillShape ? SMALL_DRILL : TO_LEGACY_LU( PtPad->m_Drill.x() );
aPlotter->flash_pad_circle( pos, diam.x, aTraceMode );
}
}
......
......@@ -352,17 +352,17 @@ static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule,
// Manage hole according to the print drill option
wxSize drill_tmp;
drill_tmp.x = TO_LEGACY_LU( pt_pad->m_Drill.x );
drill_tmp.y = TO_LEGACY_LU( pt_pad->m_Drill.y );
drill_tmp.x = TO_LEGACY_LU( pt_pad->m_Drill.x() );
drill_tmp.y = TO_LEGACY_LU( pt_pad->m_Drill.y() );
switch ( aDrillShapeOpt )
{
case PRINT_PARAMETERS::NO_DRILL_SHAPE:
pt_pad->m_Drill = VECTOR_PCB(ZERO_LENGTH, ZERO_LENGTH); //wxSize(0,0);
pt_pad->m_Drill = VECTOR_PCB::fromXY(ZERO_LENGTH, ZERO_LENGTH); //wxSize(0,0);
break;
case PRINT_PARAMETERS::SMALL_DRILL_SHAPE:
pt_pad->m_Drill.x = MIN(FROM_LEGACY_LU( SMALL_DRILL ),pt_pad->m_Drill.x );
pt_pad->m_Drill.y = MIN(FROM_LEGACY_LU( SMALL_DRILL ),pt_pad->m_Drill.y );
pt_pad->m_Drill.x() = min( FROM_LEGACY_LU( SMALL_DRILL ),pt_pad->m_Drill.x() );
pt_pad->m_Drill.y() = min( FROM_LEGACY_LU( SMALL_DRILL ),pt_pad->m_Drill.y() );
break;
case PRINT_PARAMETERS::FULL_DRILL_SHAPE:
// Do nothing
......@@ -370,8 +370,8 @@ static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule,
}
pt_pad->Draw( aPanel, aDC, aDraw_mode );
pt_pad->m_Drill.x = FROM_LEGACY_LU( drill_tmp.x );
pt_pad->m_Drill.y = FROM_LEGACY_LU( drill_tmp.y );
pt_pad->m_Drill.x() = FROM_LEGACY_LU( drill_tmp.x );
pt_pad->m_Drill.y() = FROM_LEGACY_LU( drill_tmp.y );
}
/* Print footprint graphic shapes */
......
......@@ -464,8 +464,8 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
+ pcbframe->GetBoard()->m_BoundaryBox.m_Pos.x;
int cY = ( Board.m_GridRouting * row_source )
+ pcbframe->GetBoard()->m_BoundaryBox.m_Pos.y;
int dx = TO_LEGACY_LU( pt_cur_ch->m_PadStart->m_Size.x / 2 );
int dy = TO_LEGACY_LU( pt_cur_ch->m_PadStart->m_Size.y / 2 );
int dx = TO_LEGACY_LU( pt_cur_ch->m_PadStart->m_Size.x() / 2 );
int dy = TO_LEGACY_LU( pt_cur_ch->m_PadStart->m_Size.y() / 2 );
int px = pt_cur_ch->m_PadStart->GetPosition().x;
int py = pt_cur_ch->m_PadStart->GetPosition().y;
......@@ -479,8 +479,8 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
+ pcbframe->GetBoard()->m_BoundaryBox.m_Pos.x;
cY = ( Board.m_GridRouting * row_target )
+ pcbframe->GetBoard()->m_BoundaryBox.m_Pos.y;
dx = TO_LEGACY_LU( pt_cur_ch->m_PadEnd->m_Size.x / 2 );
dy = TO_LEGACY_LU( pt_cur_ch->m_PadEnd->m_Size.y / 2 );
dx = TO_LEGACY_LU( pt_cur_ch->m_PadEnd->m_Size.x() / 2 );
dy = TO_LEGACY_LU( pt_cur_ch->m_PadEnd->m_Size.y() / 2 );
px = pt_cur_ch->m_PadEnd->GetPosition().x;
py = pt_cur_ch->m_PadEnd->GetPosition().y;
......
......@@ -250,7 +250,7 @@ static bool isRoundKeepout( D_PAD* aPad )
{
if( aPad->m_PadShape==PAD_CIRCLE )
{
if( aPad->m_Drill.x >= aPad->m_Size.x )
if( aPad->m_Drill.x() >= aPad->m_Size.x() )
return true;
if( (aPad->m_layerMask & ALL_CU_LAYERS) == 0 )
......@@ -321,11 +321,11 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad )
POINT dsnOffset;
if( aPad->m_Offset.x != ZERO_LENGTH || aPad->m_Offset.y != ZERO_LENGTH )
if( aPad->m_Offset.x() != ZERO_LENGTH || aPad->m_Offset.y() != ZERO_LENGTH )
{
char offsetTxt[64]; /// @BUG !!!Unsafe
wxPoint offset( TO_LEGACY_LU( aPad->m_Offset.x ), TO_LEGACY_LU( aPad->m_Offset.y ) );
wxPoint offset( TO_LEGACY_LU( aPad->m_Offset.x() ), TO_LEGACY_LU( aPad->m_Offset.y() ) );
dsnOffset = mapPt( offset );
......@@ -341,7 +341,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad )
default:
case PAD_CIRCLE:
{
double diameter = scale( TO_LEGACY_LU( aPad->m_Size.x ) );
double diameter = scale( TO_LEGACY_LU( aPad->m_Size.x() ) );
for( int ndx=0; ndx<reportedLayers; ++ndx )
{
......@@ -357,7 +357,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad )
}
snprintf( name, sizeof(name), "Round%sPad_%.6g_mil",
uniqifier.c_str(), scale(TO_LEGACY_LU( aPad->m_Size.x ) ) );
uniqifier.c_str(), scale(TO_LEGACY_LU( aPad->m_Size.x() ) ) );
name[ sizeof(name)-1 ] = 0;
padstack->SetPadstackId( name );
......@@ -366,8 +366,8 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad )
case PAD_RECT:
{
double dx = scale( TO_LEGACY_LU( aPad->m_Size.x ) ) / 2.0;
double dy = scale( TO_LEGACY_LU( aPad->m_Size.y ) ) / 2.0;
double dx = scale( TO_LEGACY_LU( aPad->m_Size.x() ) ) / 2.0;
double dy = scale( TO_LEGACY_LU( aPad->m_Size.y() ) ) / 2.0;
POINT lowerLeft( -dx, -dy );
POINT upperRight( dx, dy );
......@@ -388,7 +388,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad )
}
snprintf( name, sizeof(name), "Rect%sPad_%.6gx%.6g_mil",
uniqifier.c_str(), scale( TO_LEGACY_LU( aPad->m_Size.x ) ), scale( TO_LEGACY_LU( aPad->m_Size.y ) ) );
uniqifier.c_str(), scale( TO_LEGACY_LU( aPad->m_Size.x() ) ), scale( TO_LEGACY_LU( aPad->m_Size.y() ) ) );
name[ sizeof(name)-1 ] = 0;
padstack->SetPadstackId( name );
......@@ -397,8 +397,8 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad )
case PAD_OVAL:
{
double dx = scale( TO_LEGACY_LU( aPad->m_Size.x ) ) / 2.0;
double dy = scale( TO_LEGACY_LU( aPad->m_Size.y ) ) / 2.0;
double dx = scale( TO_LEGACY_LU( aPad->m_Size.x() ) ) / 2.0;
double dy = scale( TO_LEGACY_LU( aPad->m_Size.y() ) ) / 2.0;
double dr = dx - dy;
double radius;
POINT start;
......@@ -436,7 +436,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad )
}
snprintf( name, sizeof(name), "Oval%sPad_%.6gx%.6g_mil",
uniqifier.c_str(), scale( TO_LEGACY_LU( aPad->m_Size.x ) ), scale( TO_LEGACY_LU( aPad->m_Size.y ) ) );
uniqifier.c_str(), scale( TO_LEGACY_LU( aPad->m_Size.x() ) ), scale( TO_LEGACY_LU( aPad->m_Size.y() ) ) );
name[ sizeof(name)-1 ] = 0;
padstack->SetPadstackId( name );
......@@ -445,11 +445,11 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad )
case PAD_TRAPEZOID:
{
double dx = scale( TO_LEGACY_LU( aPad->m_Size.x ) ) / 2.0;
double dy = scale( TO_LEGACY_LU( aPad->m_Size.y ) ) / 2.0;
double dx = scale( TO_LEGACY_LU( aPad->m_Size.x() ) ) / 2.0;
double dy = scale( TO_LEGACY_LU( aPad->m_Size.y() ) ) / 2.0;
double ddx = scale( TO_LEGACY_LU( aPad->m_DeltaSize.x ) ) / 2.0;
double ddy = scale( TO_LEGACY_LU( aPad->m_DeltaSize.y ) ) / 2.0;
double ddx = scale( TO_LEGACY_LU( aPad->m_DeltaSize.x() ) ) / 2.0;
double ddy = scale( TO_LEGACY_LU( aPad->m_DeltaSize.y() ) ) / 2.0;
// see class_pad_draw_functions.cpp which draws the trapezoid pad
POINT lowerLeft( -dx - ddy, -dy - ddx );
......@@ -483,11 +483,11 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad )
// this string _must_ be unique for a given physical shape
snprintf( name, sizeof(name), "Trapz%sPad_%.6gx%.6g_%c%.6gx%c%.6g_mil",
uniqifier.c_str(), scale( TO_LEGACY_LU( aPad->m_Size.x ) ), scale( TO_LEGACY_LU( aPad->m_Size.y ) ),
aPad->m_DeltaSize.x < ZERO_LENGTH ? 'n' : 'p',
abs( scale( TO_LEGACY_LU( aPad->m_DeltaSize.x ) )),
aPad->m_DeltaSize.y < ZERO_LENGTH ? 'n' : 'p',
abs( scale( TO_LEGACY_LU( aPad->m_DeltaSize.y ) ))
uniqifier.c_str(), scale( TO_LEGACY_LU( aPad->m_Size.x() ) ), scale( TO_LEGACY_LU( aPad->m_Size.y() ) ),
aPad->m_DeltaSize.x() < ZERO_LENGTH ? 'n' : 'p',
fabs( scale( TO_LEGACY_LU( aPad->m_DeltaSize.x() ) )),
aPad->m_DeltaSize.y() < ZERO_LENGTH ? 'n' : 'p',
fabs( scale( TO_LEGACY_LU( aPad->m_DeltaSize.y() ) ))
);
name[ sizeof(name)-1 ] = 0;
......@@ -527,7 +527,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule )
// see if this pad is a through hole with no copper on its perimeter
if( isRoundKeepout( pad ) )
{
double diameter = scale( TO_LEGACY_LU( pad->m_Drill.x ) );
double diameter = scale( TO_LEGACY_LU( pad->m_Drill.x() ) );
POINT vertex = mapPt( TO_LEGACY_LU_WXP( pad->m_Pos0 ) );
int layerCount = aBoard->GetCopperLayerCount();
......
......@@ -201,7 +201,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
* inside the board (in fact inside the hole. Some photo diodes and Leds are
* like this)
*/
if( (pad->m_Drill.x == ZERO_LENGTH) && (pad->m_Drill.y == ZERO_LENGTH) )
if( (pad->m_Drill.x() == ZERO_LENGTH) && (pad->m_Drill.y() == ZERO_LENGTH) )
continue;
// Use a dummy pad to calculate a hole shape that have the same dimension as
......
......@@ -68,15 +68,15 @@ void BuildUnconnectedThermalStubsPolygonList( std::vector<CPolyPt>& aCornerBuffe
// Thermal bridges are like a segment from a starting point inside the pad
// to an ending point outside the pad
wxPoint startpoint, endpoint;
endpoint.x = ( TO_LEGACY_LU( pad->m_Size.x / 2 ) ) + aZone->m_ThermalReliefGapValue;
endpoint.y = ( TO_LEGACY_LU( pad->m_Size.y / 2 ) ) + aZone->m_ThermalReliefGapValue;
endpoint.x = ( TO_LEGACY_LU( pad->m_Size.x() / 2 ) ) + aZone->m_ThermalReliefGapValue;
endpoint.y = ( TO_LEGACY_LU( pad->m_Size.y() / 2 ) ) + aZone->m_ThermalReliefGapValue;
int copperThickness = aZone->m_ThermalReliefCopperBridgeValue - aZone->m_ZoneMinThickness;
if( copperThickness < 0 )
copperThickness = 0;
startpoint.x = min( TO_LEGACY_LU( pad->m_Size.x ), copperThickness );
startpoint.y = min( TO_LEGACY_LU( pad->m_Size.y ), copperThickness );
startpoint.x = min( TO_LEGACY_LU( pad->m_Size.x() ), copperThickness );
startpoint.y = min( TO_LEGACY_LU( pad->m_Size.y() ), copperThickness );
startpoint.x /= 2;
startpoint.y /= 2;
......
// math stuff for graphics, from FreePCB
#ifndef abs
/*#ifndef abs
#define abs(x) (((x) >=0) ? (x) : (-(x)))
#endif
#endif*/
typedef struct PointTag
......
......@@ -73,6 +73,8 @@ static inline int floordiv( int a, int n )
/* Note: the following work for integers and other numeric types. */
/* those are bad programming practice because of several issues with
overloading and integer limits
#undef sign
#undef abs
#undef min
......@@ -84,6 +86,79 @@ static inline int floordiv( int a, int n )
#define min( a, b ) ( (a)<(b) ? (a) : (b) )
#define max( a, b ) ( (a)>(b) ? (a) : (b) )
#define sq( a ) ( (a) * (a) )
#define cu( a ) ( (a) * (a) * (a) )
#define cu( a ) ( (a) * (a) * (a) )*/
// these functions better than macros because they do not cause double evaluation.
static inline int sign( int x )
{
return (0 < x) - (x < 0);
}
static inline int sign( long x )
{
return (0 < x) - (x < 0);
}
static inline int sign( double x )
{
return (0.0 < x) - (x < 0.0);
}
/*static inline int abs( int x ) is not required because exist in stdlib.h */
static inline long abs( long x )
{
return x < 0? -x : x;
}
static inline int max( int x, int y )
{
return x < y? y : x;
}
static inline long max( long x, long y )
{
return x < y? y : x;
}
static inline int min( int x, int y )
{
return x < y? x : y;
}
static inline long min( long x, long y )
{
return x < y? x : y;
}
static inline int sq( int x )
{
return x * x;
}
static inline long sq( long x )
{
return x * x;
}
static inline double sq( double x )
{
return x * x;
}
static inline int cu( int x )
{
return x * x * x;
}
static inline long cu( long x )
{
return x * x * x;
}
static inline double cu( double x )
{
return x * x * x;
}
#endif /* AUXILIARY_H */
......@@ -278,7 +278,7 @@ void render_curveto( render_t* rm,
* occur at an endpoint. */
dd0 = sq( x1 - 2 * x2 + x3 ) + sq( y1 - 2 * y2 + y3 );
dd1 = sq( x2 - 2 * x3 + x4 ) + sq( y2 - 2 * y3 + y4 );
dd = 6 * sqrt( max( dd0, dd1 ) );
dd = 6 * sqrt( fmax( dd0, dd1 ) );
e2 = 8 * delta <= dd ? 8 * delta / dd : 1;
epsilon = sqrt( e2 ); /* necessary interval size */
......
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