Commit e6c93885 authored by CHARRAS's avatar CHARRAS

changed ASSERT to wxASSERT in math_for_graphic.cpp

parent 25c149bb
...@@ -4,9 +4,6 @@ ...@@ -4,9 +4,6 @@
// //
using namespace std; using namespace std;
#define SetSize reserve // used in conversion from freePCB to kicad.: The code using it must be rewitten
#include <math.h> #include <math.h>
#include <vector> #include <vector>
...@@ -250,7 +247,7 @@ int CPolyLine::MakeGpcPoly( int icontour, std::vector<CArc> * arc_array ) ...@@ -250,7 +247,7 @@ int CPolyLine::MakeGpcPoly( int icontour, std::vector<CArc> * arc_array )
last_contour = GetNumContours() - 1; last_contour = GetNumContours() - 1;
} }
if( arc_array ) if( arc_array )
arc_array->SetSize(0); arc_array->clear();
int iarc = 0; int iarc = 0;
for( int icont=first_contour; icont<=last_contour; icont++ ) for( int icont=first_contour; icont<=last_contour; icont++ )
{ {
...@@ -398,13 +395,14 @@ int CPolyLine::MakeGpcPoly( int icontour, std::vector<CArc> * arc_array ) ...@@ -398,13 +395,14 @@ int CPolyLine::MakeGpcPoly( int icontour, std::vector<CArc> * arc_array )
// now write steps for arc // now write steps for arc
if( arc_array ) if( arc_array )
{ {
arc_array->SetSize(iarc+1); CArc new_arc;
(*arc_array)[iarc].style = style; new_arc.style = style;
(*arc_array)[iarc].n_steps = n; new_arc.n_steps = n;
(*arc_array)[iarc].xi = x1; new_arc.xi = x1;
(*arc_array)[iarc].yi = y1; new_arc.yi = y1;
(*arc_array)[iarc].xf = x2; new_arc.xf = x2;
(*arc_array)[iarc].yf = y2; new_arc.yf = y2;
arc_array->push_back(new_arc);
iarc++; iarc++;
} }
for( int is=0; is<n; is++ ) for( int is=0; is<n; is++ )
......
...@@ -8,6 +8,8 @@ using namespace std; ...@@ -8,6 +8,8 @@ using namespace std;
#include <float.h> #include <float.h>
#include <limits.h> #include <limits.h>
#include "fctsys.h"
#include "defs-macros.h" #include "defs-macros.h"
#include "PolyLine2Kicad.h" #include "PolyLine2Kicad.h"
...@@ -60,7 +62,7 @@ CPoint GetInflectionPoint( CPoint pi, CPoint pf, int mode ) ...@@ -60,7 +62,7 @@ CPoint GetInflectionPoint( CPoint pi, CPoint pf, int mode )
} }
} }
else else
ASSERT(0); wxASSERT(0);
} }
else else
{ {
...@@ -86,7 +88,7 @@ CPoint GetInflectionPoint( CPoint pi, CPoint pf, int mode ) ...@@ -86,7 +88,7 @@ CPoint GetInflectionPoint( CPoint pi, CPoint pf, int mode )
} }
} }
else else
ASSERT(0); wxASSERT(0);
} }
} }
return p; return p;
...@@ -613,7 +615,7 @@ int FindLineSegmentIntersection( double a, double b, int xi, int yi, int xf, int ...@@ -613,7 +615,7 @@ int FindLineSegmentIntersection( double a, double b, int xi, int yi, int xf, int
return npts; return npts;
} }
else else
ASSERT(0); wxASSERT(0);
} }
else else
{ {
...@@ -1062,7 +1064,7 @@ void DrawArc( CDC * pDC, int shape, int xxi, int yyi, int xxf, int yyf, bool bMe ...@@ -1062,7 +1064,7 @@ void DrawArc( CDC * pDC, int shape, int xxi, int yyi, int xxf, int yyf, bool bMe
pDC->MoveTo( xxf, yyf ); pDC->MoveTo( xxf, yyf );
} }
else else
ASSERT(0); // oops wxASSERT(0); // oops
} }
#endif #endif
...@@ -1182,7 +1184,7 @@ void GetPadElements( int type, int x, int y, int wid, int len, int radius, int a ...@@ -1182,7 +1184,7 @@ void GetPadElements( int type, int x, int y, int wid, int len, int radius, int a
} }
return; return;
} }
ASSERT(0); wxASSERT(0);
} }
// Find distance from a staright line segment to a pad // Find distance from a staright line segment to a pad
...@@ -1310,9 +1312,9 @@ int GetClearanceBetweenSegments( int x1i, int y1i, int x1f, int y1f, int style1, ...@@ -1310,9 +1312,9 @@ int GetClearanceBetweenSegments( int x1i, int y1i, int x1f, int y1f, int style1,
const int NSTEPS = 32; const int NSTEPS = 32;
if( el1.theta2 > el1.theta1 ) if( el1.theta2 > el1.theta1 )
ASSERT(0); wxASSERT(0);
if( bArcs && el2.theta2 > el2.theta1 ) if( bArcs && el2.theta2 > el2.theta1 )
ASSERT(0); wxASSERT(0);
// test multiple points in both segments // test multiple points in both segments
double th1; double th1;
...@@ -1570,7 +1572,7 @@ double Distance( int x1, int y1, int x2, int y2 ) ...@@ -1570,7 +1572,7 @@ double Distance( int x1, int y1, int x2, int y2 )
double d; double d;
d = sqrt( (double)(x1-x2)*(x1-x2) + (double)(y1-y2)*(y1-y2) ); d = sqrt( (double)(x1-x2)*(x1-x2) + (double)(y1-y2)*(y1-y2) );
if( d > INT_MAX || d < INT_MIN ) if( d > INT_MAX || d < INT_MIN )
ASSERT(0); wxASSERT(0);
return (int)d; return (int)d;
} }
...@@ -1581,9 +1583,9 @@ int GetArcIntersections( EllipseKH * el1, EllipseKH * el2, ...@@ -1581,9 +1583,9 @@ int GetArcIntersections( EllipseKH * el1, EllipseKH * el2,
double * x1, double * y1, double * x2, double * y2 ) double * x1, double * y1, double * x2, double * y2 )
{ {
if( el1->theta2 > el1->theta1 ) if( el1->theta2 > el1->theta1 )
ASSERT(0); wxASSERT(0);
if( el2->theta2 > el2->theta1 ) if( el2->theta2 > el2->theta1 )
ASSERT(0); wxASSERT(0);
const int NSTEPS = 32; const int NSTEPS = 32;
double xret[2], yret[2]; double xret[2], yret[2];
...@@ -1637,7 +1639,7 @@ int GetArcIntersections( EllipseKH * el1, EllipseKH * el2, ...@@ -1637,7 +1639,7 @@ int GetArcIntersections( EllipseKH * el1, EllipseKH * el2,
yret[n] = y*el1->yrad + el1->Center.Y; yret[n] = y*el1->yrad + el1->Center.Y;
n++; n++;
if( n > 2 ) if( n > 2 )
ASSERT(0); wxASSERT(0);
} }
} }
} }
...@@ -1664,9 +1666,9 @@ double GetArcClearance( EllipseKH * el1, EllipseKH * el2, ...@@ -1664,9 +1666,9 @@ double GetArcClearance( EllipseKH * el1, EllipseKH * el2,
const int NSTEPS = 32; const int NSTEPS = 32;
if( el1->theta2 > el1->theta1 ) if( el1->theta2 > el1->theta1 )
ASSERT(0); wxASSERT(0);
if( el2->theta2 > el2->theta1 ) if( el2->theta2 > el2->theta1 )
ASSERT(0); wxASSERT(0);
// test multiple positions in both arcs, moving clockwise (ie. decreasing theta) // test multiple positions in both arcs, moving clockwise (ie. decreasing theta)
double th_start = el1->theta1; double th_start = el1->theta1;
......
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