Loading pcbnew/zones_test_and_combine_areas.cpp +6 −8 Original line number Original line Diff line number Diff line Loading @@ -387,8 +387,8 @@ bool BOARD::TestAreaIntersections( ZONE_CONTAINER* area_to_test ) yf2 = poly2->GetY( is2 ); yf2 = poly2->GetY( is2 ); } } int n_int = FindSegmentIntersections( xi1, yi1, xf1, yf1, STRAIGHT, int n_int = FindSegmentIntersections( xi1, yi1, xf1, yf1, xi2, yi2, xf2, yf2, STRAIGHT ); xi2, yi2, xf2, yf2 ); if( n_int ) if( n_int ) return true; return true; } } Loading Loading @@ -498,8 +498,8 @@ int BOARD::TestAreaIntersection( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_ yf2 = poly2->GetY( is2 ); yf2 = poly2->GetY( is2 ); } } int n_int = FindSegmentIntersections( xi1, yi1, xf1, yf1, STRAIGHT, int n_int = FindSegmentIntersections( xi1, yi1, xf1, yf1, xi2, yi2, xf2, yf2, STRAIGHT ); xi2, yi2, xf2, yf2 ); if( n_int ) if( n_int ) { { bInt = true; bInt = true; Loading Loading @@ -844,10 +844,8 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E int x, y; int x, y; int d = GetClearanceBetweenSegments( bx1, by1, bx2, by2, int d = GetClearanceBetweenSegments( bx1, by1, bx2, by2, STRAIGHT, 0, 0, ax1, ay1, ax2, ay2, ax1, ay1, ax2, ay2, STRAIGHT, 0, 0, zone2zoneClearance, zone2zoneClearance, &x, &y ); &x, &y ); Loading Loading @@ -987,9 +985,9 @@ bool DRC::doEdgeZoneDrc( ZONE_CONTAINER* aArea, int aCornerIndex ) } } int x, y; // variables containing the intersecting point coordinates int x, y; // variables containing the intersecting point coordinates int d = GetClearanceBetweenSegments( bx1, by1, bx2, by2, STRAIGHT, int d = GetClearanceBetweenSegments( bx1, by1, bx2, by2, 0, 0, ax1, ay1, ax2, ay2, STRAIGHT, ax1, ay1, ax2, ay2, 0, 0, zone_clearance, zone_clearance, &x, &y ); &x, &y ); Loading polygon/PolyLine.cpp +3 −7 Original line number Original line Diff line number Diff line Loading @@ -1112,7 +1112,6 @@ void CPolyLine::Hatch() m_CornersList[ic].x, m_CornersList[ic].y, m_CornersList[ic].x, m_CornersList[ic].y, m_CornersList[i_start_contour].x, m_CornersList[i_start_contour].x, m_CornersList[i_start_contour].y, m_CornersList[i_start_contour].y, STRAIGHT, &x, &y, &x2, &y2 ); &x, &y, &x2, &y2 ); i_start_contour = ic + 1; i_start_contour = ic + 1; } } Loading @@ -1121,7 +1120,6 @@ void CPolyLine::Hatch() ok = FindLineSegmentIntersection( a, slope, ok = FindLineSegmentIntersection( a, slope, m_CornersList[ic].x, m_CornersList[ic].y, m_CornersList[ic].x, m_CornersList[ic].y, m_CornersList[ic + 1].x, m_CornersList[ic + 1].y, m_CornersList[ic + 1].x, m_CornersList[ic + 1].y, STRAIGHT, &x, &y, &x2, &y2 ); &x, &y, &x2, &y2 ); } } Loading Loading @@ -1387,9 +1385,9 @@ int CPolyLine::Distance( wxPoint aStart, wxPoint aEnd, int aWidth ) by2 = GetY( ic2 + 1 ); by2 = GetY( ic2 + 1 ); } } int d = GetClearanceBetweenSegments( bx1, by1, bx2, by2, STRAIGHT, 0, int d = GetClearanceBetweenSegments( bx1, by1, bx2, by2, 0, aStart.x, aStart.y, aEnd.x, aEnd.y, aStart.x, aStart.y, aEnd.x, aEnd.y, STRAIGHT, aWidth, aWidth, 1, // min clearance, should be > 0 1, // min clearance, should be > 0 NULL, NULL ); NULL, NULL ); Loading Loading @@ -1689,9 +1687,7 @@ bool CPolyLine::IsPolygonSelfIntersecting() int x2f = GetX( is2_next ); int x2f = GetX( is2_next ); int y2f = GetY( is2_next ); int y2f = GetY( is2_next ); int ret = FindSegmentIntersections( x1i, y1i, x1f, y1f, int ret = FindSegmentIntersections( x1i, y1i, x1f, y1f, STRAIGHT, x2i, y2i, x2f, y2f ); x2i, y2i, x2f, y2f, STRAIGHT ); if( ret ) if( ret ) { { // intersection between non-adjacent sides // intersection between non-adjacent sides Loading polygon/math_for_graphics.cpp +87 −921 File changed.Preview size limit exceeded, changes collapsed. Show changes polygon/math_for_graphics.h +27 −6 Original line number Original line Diff line number Diff line Loading @@ -10,12 +10,23 @@ */ */ bool TestLineHit( int xi, int yi, int xf, int yf, int x, int y, double dist ); 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, /* Function FindLineSegmentIntersection * find intersection between line y = a + bx and line segment (xi,yi) to (xf,yf) * if b > DBL_MAX/10, assume vertical line at x = a * return false if no intersection or true if intersect * return coords of intersections in *x1, *y1, *x2, *y2 * if no intersection, returns min distance in dist */ bool FindLineSegmentIntersection( double a, double b, int xi, int yi, int xf, int yf, double * x1, double * y1, double * x2, double * y2, double * dist=NULL ); double * x1, double * y1, double * x2, double * y2, double * dist=NULL ); int FindSegmentIntersections( int xi, int yi, int xf, int yf, int style, /* Function FindSegmentIntersections int xi2, int yi2, int xf2, int yf2, int style2, * find intersections between line segment (xi,yi) to (xf,yf) double x[]=NULL, double y[]=NULL ); * and line segment (xi2,yi2) to (xf2,yf2) * returns true if intersection found */ bool FindSegmentIntersections( int xi, int yi, int xf, int yf, int xi2, int yi2, int xf2, int yf2 ); /** /** * Function TestForIntersectionOfStraightLineSegments * Function TestForIntersectionOfStraightLineSegments Loading @@ -34,8 +45,13 @@ bool TestForIntersectionOfStraightLineSegments( int x1i, int y1i, int x1f, int y int x2i, int y2i, int x2f, int y2f, int x2i, int y2i, int x2f, int y2f, int * x=NULL, int * y=NULL, double * dist=NULL ); int * x=NULL, int * y=NULL, double * dist=NULL ); int GetClearanceBetweenSegments( int x1i, int y1i, int x1f, int y1f, int style1, int w1, /* Function GetClearanceBetweenSegments int x2i, int y2i, int x2f, int y2f, int style2, int w2, * Get clearance between 2 segments * Returns coordinates of the closest point between these 2 segments in x, y * If clearance > max_cl, just returns max_cl+1 and doesn't return x,y */ int GetClearanceBetweenSegments( int x1i, int y1i, int x1f, int y1f, int w1, int x2i, int y2i, int x2f, int y2f, int w2, int max_cl, int * x, int * y ); int max_cl, int * x, int * y ); /** /** Loading @@ -47,6 +63,11 @@ int GetClearanceBetweenSegments( int x1i, int y1i, int x1f, int y1f, int style1, */ */ double GetPointToLineSegmentDistance( int x, int y, int xi, int yi, int xf, int yf ); double GetPointToLineSegmentDistance( int x, int y, int xi, int yi, int xf, int yf ); /* Function GetPointToLineDistance * Get min. distance from (x,y) to line y = a + bx * if b > DBL_MAX/10, assume vertical line at x = a * returns closest point on line in xpp, ypp */ double GetPointToLineDistance( double a, double b, int x, int y, double * xp=NULL, double * yp=NULL ); double GetPointToLineDistance( double a, double b, int x, int y, double * xp=NULL, double * yp=NULL ); double Distance( double x1, double y1, double x2, double y2 ); double Distance( double x1, double y1, double x2, double y2 ); Loading
pcbnew/zones_test_and_combine_areas.cpp +6 −8 Original line number Original line Diff line number Diff line Loading @@ -387,8 +387,8 @@ bool BOARD::TestAreaIntersections( ZONE_CONTAINER* area_to_test ) yf2 = poly2->GetY( is2 ); yf2 = poly2->GetY( is2 ); } } int n_int = FindSegmentIntersections( xi1, yi1, xf1, yf1, STRAIGHT, int n_int = FindSegmentIntersections( xi1, yi1, xf1, yf1, xi2, yi2, xf2, yf2, STRAIGHT ); xi2, yi2, xf2, yf2 ); if( n_int ) if( n_int ) return true; return true; } } Loading Loading @@ -498,8 +498,8 @@ int BOARD::TestAreaIntersection( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_ yf2 = poly2->GetY( is2 ); yf2 = poly2->GetY( is2 ); } } int n_int = FindSegmentIntersections( xi1, yi1, xf1, yf1, STRAIGHT, int n_int = FindSegmentIntersections( xi1, yi1, xf1, yf1, xi2, yi2, xf2, yf2, STRAIGHT ); xi2, yi2, xf2, yf2 ); if( n_int ) if( n_int ) { { bInt = true; bInt = true; Loading Loading @@ -844,10 +844,8 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E int x, y; int x, y; int d = GetClearanceBetweenSegments( bx1, by1, bx2, by2, int d = GetClearanceBetweenSegments( bx1, by1, bx2, by2, STRAIGHT, 0, 0, ax1, ay1, ax2, ay2, ax1, ay1, ax2, ay2, STRAIGHT, 0, 0, zone2zoneClearance, zone2zoneClearance, &x, &y ); &x, &y ); Loading Loading @@ -987,9 +985,9 @@ bool DRC::doEdgeZoneDrc( ZONE_CONTAINER* aArea, int aCornerIndex ) } } int x, y; // variables containing the intersecting point coordinates int x, y; // variables containing the intersecting point coordinates int d = GetClearanceBetweenSegments( bx1, by1, bx2, by2, STRAIGHT, int d = GetClearanceBetweenSegments( bx1, by1, bx2, by2, 0, 0, ax1, ay1, ax2, ay2, STRAIGHT, ax1, ay1, ax2, ay2, 0, 0, zone_clearance, zone_clearance, &x, &y ); &x, &y ); Loading
polygon/PolyLine.cpp +3 −7 Original line number Original line Diff line number Diff line Loading @@ -1112,7 +1112,6 @@ void CPolyLine::Hatch() m_CornersList[ic].x, m_CornersList[ic].y, m_CornersList[ic].x, m_CornersList[ic].y, m_CornersList[i_start_contour].x, m_CornersList[i_start_contour].x, m_CornersList[i_start_contour].y, m_CornersList[i_start_contour].y, STRAIGHT, &x, &y, &x2, &y2 ); &x, &y, &x2, &y2 ); i_start_contour = ic + 1; i_start_contour = ic + 1; } } Loading @@ -1121,7 +1120,6 @@ void CPolyLine::Hatch() ok = FindLineSegmentIntersection( a, slope, ok = FindLineSegmentIntersection( a, slope, m_CornersList[ic].x, m_CornersList[ic].y, m_CornersList[ic].x, m_CornersList[ic].y, m_CornersList[ic + 1].x, m_CornersList[ic + 1].y, m_CornersList[ic + 1].x, m_CornersList[ic + 1].y, STRAIGHT, &x, &y, &x2, &y2 ); &x, &y, &x2, &y2 ); } } Loading Loading @@ -1387,9 +1385,9 @@ int CPolyLine::Distance( wxPoint aStart, wxPoint aEnd, int aWidth ) by2 = GetY( ic2 + 1 ); by2 = GetY( ic2 + 1 ); } } int d = GetClearanceBetweenSegments( bx1, by1, bx2, by2, STRAIGHT, 0, int d = GetClearanceBetweenSegments( bx1, by1, bx2, by2, 0, aStart.x, aStart.y, aEnd.x, aEnd.y, aStart.x, aStart.y, aEnd.x, aEnd.y, STRAIGHT, aWidth, aWidth, 1, // min clearance, should be > 0 1, // min clearance, should be > 0 NULL, NULL ); NULL, NULL ); Loading Loading @@ -1689,9 +1687,7 @@ bool CPolyLine::IsPolygonSelfIntersecting() int x2f = GetX( is2_next ); int x2f = GetX( is2_next ); int y2f = GetY( is2_next ); int y2f = GetY( is2_next ); int ret = FindSegmentIntersections( x1i, y1i, x1f, y1f, int ret = FindSegmentIntersections( x1i, y1i, x1f, y1f, STRAIGHT, x2i, y2i, x2f, y2f ); x2i, y2i, x2f, y2f, STRAIGHT ); if( ret ) if( ret ) { { // intersection between non-adjacent sides // intersection between non-adjacent sides Loading
polygon/math_for_graphics.cpp +87 −921 File changed.Preview size limit exceeded, changes collapsed. Show changes
polygon/math_for_graphics.h +27 −6 Original line number Original line Diff line number Diff line Loading @@ -10,12 +10,23 @@ */ */ bool TestLineHit( int xi, int yi, int xf, int yf, int x, int y, double dist ); 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, /* Function FindLineSegmentIntersection * find intersection between line y = a + bx and line segment (xi,yi) to (xf,yf) * if b > DBL_MAX/10, assume vertical line at x = a * return false if no intersection or true if intersect * return coords of intersections in *x1, *y1, *x2, *y2 * if no intersection, returns min distance in dist */ bool FindLineSegmentIntersection( double a, double b, int xi, int yi, int xf, int yf, double * x1, double * y1, double * x2, double * y2, double * dist=NULL ); double * x1, double * y1, double * x2, double * y2, double * dist=NULL ); int FindSegmentIntersections( int xi, int yi, int xf, int yf, int style, /* Function FindSegmentIntersections int xi2, int yi2, int xf2, int yf2, int style2, * find intersections between line segment (xi,yi) to (xf,yf) double x[]=NULL, double y[]=NULL ); * and line segment (xi2,yi2) to (xf2,yf2) * returns true if intersection found */ bool FindSegmentIntersections( int xi, int yi, int xf, int yf, int xi2, int yi2, int xf2, int yf2 ); /** /** * Function TestForIntersectionOfStraightLineSegments * Function TestForIntersectionOfStraightLineSegments Loading @@ -34,8 +45,13 @@ bool TestForIntersectionOfStraightLineSegments( int x1i, int y1i, int x1f, int y int x2i, int y2i, int x2f, int y2f, int x2i, int y2i, int x2f, int y2f, int * x=NULL, int * y=NULL, double * dist=NULL ); int * x=NULL, int * y=NULL, double * dist=NULL ); int GetClearanceBetweenSegments( int x1i, int y1i, int x1f, int y1f, int style1, int w1, /* Function GetClearanceBetweenSegments int x2i, int y2i, int x2f, int y2f, int style2, int w2, * Get clearance between 2 segments * Returns coordinates of the closest point between these 2 segments in x, y * If clearance > max_cl, just returns max_cl+1 and doesn't return x,y */ int GetClearanceBetweenSegments( int x1i, int y1i, int x1f, int y1f, int w1, int x2i, int y2i, int x2f, int y2f, int w2, int max_cl, int * x, int * y ); int max_cl, int * x, int * y ); /** /** Loading @@ -47,6 +63,11 @@ int GetClearanceBetweenSegments( int x1i, int y1i, int x1f, int y1f, int style1, */ */ double GetPointToLineSegmentDistance( int x, int y, int xi, int yi, int xf, int yf ); double GetPointToLineSegmentDistance( int x, int y, int xi, int yi, int xf, int yf ); /* Function GetPointToLineDistance * Get min. distance from (x,y) to line y = a + bx * if b > DBL_MAX/10, assume vertical line at x = a * returns closest point on line in xpp, ypp */ double GetPointToLineDistance( double a, double b, int x, int y, double * xp=NULL, double * yp=NULL ); double GetPointToLineDistance( double a, double b, int x, int y, double * xp=NULL, double * yp=NULL ); double Distance( double x1, double y1, double x2, double y2 ); double Distance( double x1, double y1, double x2, double y2 );