Commit dfdd2cfd authored by jean-pierre charras's avatar jean-pierre charras

Remove freepcb arc legacy code from PolyLine.

parent ae05cd80
......@@ -44,6 +44,7 @@
#include <class_board.h>
#include <class_module.h>
#include <polygon_test_point_inside.h>
int D_PAD::m_PadSketchModePenSize = 0; // Pen size used to draw pads in sketch mode
......
......@@ -47,6 +47,7 @@
#include <pcbnew.h>
#include <zones.h>
#include <math_for_graphics.h>
#include <polygon_test_point_inside.h>
ZONE_CONTAINER::ZONE_CONTAINER( BOARD* aBoard ) :
......
......@@ -45,6 +45,7 @@
#include <class_zone.h>
#include <class_marker_pcb.h>
#include <math_for_graphics.h>
#include <polygon_test_point_inside.h>
/* compare 2 trapezoids (can be rectangle) and return true if distance > aDist
......
......@@ -35,6 +35,7 @@
#include <pcbnew.h>
#include <zones.h>
#include <polygon_test_point_inside.h>
/**
......
......@@ -28,7 +28,6 @@
#include <algorithm> // sort
#include <fctsys.h>
#include <common.h>
#include <macros.h>
......@@ -40,6 +39,7 @@
#include <pcbnew.h>
#include <zones.h>
#include <polygon_test_point_inside.h>
static bool CmpZoneSubnetValue( const BOARD_CONNECTED_ITEM* a, const BOARD_CONNECTED_ITEM* b );
void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb, int aNetcode );
......
......@@ -43,6 +43,7 @@
#include <drc_stuff.h>
#include <math_for_graphics.h>
#define STRAIGHT 0 // To be remove after math_for_graphics code cleanup
/**
* Function AddArea
......@@ -386,8 +387,8 @@ bool BOARD::TestAreaIntersections( ZONE_CONTAINER* area_to_test )
yf2 = poly2->GetY( is2 );
}
int n_int = FindSegmentIntersections( xi1, yi1, xf1, yf1, CPolyLine::STRAIGHT,
xi2, yi2, xf2, yf2, CPolyLine::STRAIGHT );
int n_int = FindSegmentIntersections( xi1, yi1, xf1, yf1, STRAIGHT,
xi2, yi2, xf2, yf2, STRAIGHT );
if( n_int )
return true;
}
......@@ -497,8 +498,8 @@ int BOARD::TestAreaIntersection( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_
yf2 = poly2->GetY( is2 );
}
int n_int = FindSegmentIntersections( xi1, yi1, xf1, yf1, CPolyLine::STRAIGHT,
xi2, yi2, xf2, yf2, CPolyLine::STRAIGHT );
int n_int = FindSegmentIntersections( xi1, yi1, xf1, yf1, STRAIGHT,
xi2, yi2, xf2, yf2, STRAIGHT );
if( n_int )
{
bInt = true;
......@@ -843,10 +844,10 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E
int x, y;
int d = GetClearanceBetweenSegments( bx1, by1, bx2, by2,
CPolyLine::STRAIGHT,
STRAIGHT,
0,
ax1, ay1, ax2, ay2,
CPolyLine::STRAIGHT,
STRAIGHT,
0,
zone2zoneClearance,
&x, &y );
......@@ -986,9 +987,9 @@ bool DRC::doEdgeZoneDrc( ZONE_CONTAINER* aArea, int aCornerIndex )
}
int x, y; // variables containing the intersecting point coordinates
int d = GetClearanceBetweenSegments( bx1, by1, bx2, by2, CPolyLine::STRAIGHT,
int d = GetClearanceBetweenSegments( bx1, by1, bx2, by2, STRAIGHT,
0,
ax1, ay1, ax2, ay2, CPolyLine::STRAIGHT,
ax1, ay1, ax2, ay2, STRAIGHT,
0,
zone_clearance,
&x, &y );
......
This diff is collapsed.
......@@ -24,13 +24,13 @@
#include <polygons_defs.h>
// inflection modes for DS_LINE and DS_LINE_VERTEX, used in math_for_graphics.cpp
enum {
/*enum {
IM_NONE = 0,
IM_90_45,
IM_45_90,
IM_90
};
*/
class CRect
{
......@@ -58,6 +58,7 @@ public:
}
};
/*
class CArc
{
public:
......@@ -67,7 +68,7 @@ public:
int n_steps; // number of straight-line segments in gpc_poly
bool bFound;
};
*/
class CPolyPt : public wxPoint
{
......@@ -98,12 +99,9 @@ public:
};
#include <polygon_test_point_inside.h>
class CPolyLine
{
public:
enum m_SideStyle { STRAIGHT, ARC_CW, ARC_CCW }; // side styles
enum HATCH_STYLE { NO_HATCH, DIAGONAL_FULL, DIAGONAL_EDGE }; // hatch styles
// constructors/destructor
......@@ -197,7 +195,6 @@ public:
int GetUtility( int ic ) { return m_CornersList[ic].m_utility; };
void SetUtility( int ic, int utility ) { m_CornersList[ic].m_utility = utility; };
int GetSideStyle( int is );
int GetHatchPitch() { return m_hatchPitch; }
static int GetDefaultHatchPitchMils() { return 20; } // default hatch pitch value in mils
......@@ -214,7 +211,6 @@ public:
void SetX( int ic, int x );
void SetY( int ic, int y );
void SetEndContour( int ic, bool end_contour );
void SetSideStyle( int is, int style );
void SetHatchStyle( enum HATCH_STYLE style )
{
......@@ -299,7 +295,6 @@ private:
Bool_Engine* m_Kbool_Poly_Engine; // polygons set in kbool engine data
public:
std::vector <CPolyPt> m_CornersList; // array of points for corners
std::vector <int> m_SideStyle; // array of styles for sides
std::vector <CSegment> m_HatchLines; // hatch lines showing the polygon area
};
......
......@@ -34,12 +34,17 @@ double Distance( double x1, double y1, double x2, double y2 )
return d;
}
static bool Quadratic( double a, double b, double c, double *x1, double *x2 );
static bool FindLineEllipseIntersections( double a, double b, double c, double d, double *x1, double *x2 );
static bool FindVerticalLineEllipseIntersections( double a, double b, double x, double *y1, double *y2 );
static int GetArcIntersections( EllipseKH * el1, EllipseKH * el2,
double * x1=NULL, double * y1=NULL,
double * x2=NULL, double * y2=NULL );
static bool InRange( double x, double xi, double xf );
enum m_SideStyle { STRAIGHT, ARC_CW, ARC_CCW }; // side styles
/**
......@@ -112,7 +117,7 @@ int MakeEllipseFromArc( int xi, int yi, int xf, int yf, int style, EllipseKH* el
// convert to clockwise arc
int xxi, xxf, yyi, yyf;
if( style == CPolyLine::ARC_CCW )
if( style == ARC_CCW )
{
xxi = xf;
xxf = xi;
......@@ -199,7 +204,7 @@ int FindSegmentIntersections( int xi, int yi, int xf, int yf, int style,
|| min( yi, yf ) > max( yi2, yf2 ) )
return 0;
if( style != CPolyLine::STRAIGHT && style2 != CPolyLine::STRAIGHT )
if( style != STRAIGHT && style2 != STRAIGHT )
{
// two identical arcs intersect
if( style == style2 && xi == xi2 && yi == yi2 && xf == xf2 && yf == yf2 )
......@@ -224,7 +229,7 @@ int FindSegmentIntersections( int xi, int yi, int xf, int yf, int style,
}
}
if( style == CPolyLine::STRAIGHT && style2 == CPolyLine::STRAIGHT )
if( style == STRAIGHT && style2 == STRAIGHT )
{
// both straight-line segments
int x, y;
......@@ -246,7 +251,7 @@ int FindSegmentIntersections( int xi, int yi, int xf, int yf, int style,
yr[0] = y;
iret = 1;
}
else if( style == CPolyLine::STRAIGHT )
else if( style == STRAIGHT )
{
// first segment is straight, second segment is an arc
int ret;
......@@ -288,7 +293,7 @@ int FindSegmentIntersections( int xi, int yi, int xf, int yf, int style,
}
}
}
else if( style2 == CPolyLine::STRAIGHT )
else if( style2 == STRAIGHT )
{
// first segment is an arc, second segment is straight
int ret;
......@@ -381,7 +386,7 @@ int FindLineSegmentIntersection( double a, double b, int xi, int yi, int xf, int
if( xf != xi )
{
// non-vertical segment, get intersection
if( style == CPolyLine::STRAIGHT || yf == yi )
if( style == STRAIGHT || yf == yi )
{
// horizontal or oblique straight segment
// put into form y = c + dx;
......@@ -436,13 +441,13 @@ int FindLineSegmentIntersection( double a, double b, int xi, int yi, int xf, int
return 0;
}
}
else if( style == CPolyLine::ARC_CW || style == CPolyLine::ARC_CCW )
else if( style == ARC_CW || style == ARC_CCW )
{
// arc (quadrant of ellipse)
// convert to clockwise arc
int xxi, xxf, yyi, yyf;
if( style == CPolyLine::ARC_CCW )
if( style == ARC_CCW )
{
xxi = xf;
xxf = xi;
......@@ -640,7 +645,7 @@ bool TestForIntersectionOfStraightLineSegments( int x1i, int y1i, int x1f, int y
a = (double) y2i - b * x2i;
double x1, y1, x2, y2;
int test = FindLineSegmentIntersection( a, b, x1i, y1i, x1f, y1f, CPolyLine::STRAIGHT,
int test = FindLineSegmentIntersection( a, b, x1i, y1i, x1f, y1f, STRAIGHT,
&x1, &y1, &x2, &y2 );
if( test )
......@@ -668,7 +673,7 @@ bool TestForIntersectionOfStraightLineSegments( int x1i, int y1i, int x1f, int y
a = (double) y2i - b * x2i;
double x1, y1, x2, y2;
int test = FindLineSegmentIntersection( a, b, x1i, y1i, x1f, y1f, CPolyLine::STRAIGHT,
int test = FindLineSegmentIntersection( a, b, x1i, y1i, x1f, y1f, STRAIGHT,
&x1, &y1, &x2, &y2 );
if( test )
......@@ -696,7 +701,7 @@ bool TestForIntersectionOfStraightLineSegments( int x1i, int y1i, int x1f, int y
a = (double) y1i - b * x1i;
double x1, y1, x2, y2;
int test = FindLineSegmentIntersection( a, b, x2i, y2i, x2f, y2f, CPolyLine::STRAIGHT,
int test = FindLineSegmentIntersection( a, b, x2i, y2i, x2f, y2f, STRAIGHT,
&x1, &y1, &x2, &y2 );
if( test )
......@@ -724,7 +729,7 @@ bool TestForIntersectionOfStraightLineSegments( int x1i, int y1i, int x1f, int y
a = (double) y1i - b * x1i;
double x1, y1, x2, y2;
int test = FindLineSegmentIntersection( a, b, x2i, y2i, x2f, y2f, CPolyLine::STRAIGHT,
int test = FindLineSegmentIntersection( a, b, x2i, y2i, x2f, y2f, STRAIGHT,
&x1, &y1, &x2, &y2 );
if( test )
......@@ -760,7 +765,7 @@ bool TestForIntersectionOfStraightLineSegments( int x1i, int y1i, int x1f, int y
y2i,
x2f,
y2f,
CPolyLine::STRAIGHT,
STRAIGHT,
&x1,
&y1,
&x2,
......@@ -904,7 +909,7 @@ int GetClearanceBetweenSegments( int x1i, int y1i, int x1f, int y1f, int style1,
if( min( y2i, y2f ) - max( y1i, y1f ) > min_dist )
return max_cl+1;
if( style1 == CPolyLine::STRAIGHT && style1 == CPolyLine::STRAIGHT )
if( style1 == STRAIGHT && style1 == STRAIGHT )
{
// both segments are straight lines
int xx, yy;
......@@ -948,7 +953,7 @@ int GetClearanceBetweenSegments( int x1i, int y1i, int x1f, int y1f, int style1,
bool bArcs;
int xi = 0, yi = 0, xf = 0, yf = 0;
if( style2 == CPolyLine::STRAIGHT )
if( style2 == STRAIGHT )
{
// style1 = arc, style2 = straight
MakeEllipseFromArc( x1i, y1i, x1f, y1f, style1, &el1 );
......@@ -958,7 +963,7 @@ int GetClearanceBetweenSegments( int x1i, int y1i, int x1f, int y1f, int style1,
yf = y2f;
bArcs = false;
}
else if( style1 == CPolyLine::STRAIGHT )
else if( style1 == STRAIGHT )
{
// style2 = arc, style1 = straight
xi = x1i;
......
// math stuff for graphics, from FreePCB
// math stuff for graphics
bool Quadratic( double a, double b, double c, double *x1, double *x2 );
/**
* Function TestLineHit
* test for hit on line segment i.e. a point within a given distance from segment
......@@ -16,11 +12,10 @@ bool TestLineHit( int xi, int yi, int xf, int yf, int x, int y, double dist );
int FindLineSegmentIntersection( double a, double b, int xi, int yi, int xf, int yf, int style,
double * x1, double * y1, double * x2, double * y2, double * dist=NULL );
int FindSegmentIntersections( int xi, int yi, int xf, int yf, int style,
int xi2, int yi2, int xf2, int yf2, int style2,
double x[]=NULL, double y[]=NULL );
bool FindLineEllipseIntersections( double a, double b, double c, double d, double *x1, double *x2 );
bool FindVerticalLineEllipseIntersections( double a, double b, double x, double *y1, double *y2 );
/**
* Function TestForIntersectionOfStraightLineSegments
......
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