Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
dfdd2cfd
Commit
dfdd2cfd
authored
Jul 31, 2012
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove freepcb arc legacy code from PolyLine.
parent
ae05cd80
Changes
10
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
58 additions
and
270 deletions
+58
-270
class_pad.cpp
pcbnew/class_pad.cpp
+1
-0
class_zone.cpp
pcbnew/class_zone.cpp
+1
-0
drc_clearance_test_functions.cpp
pcbnew/drc_clearance_test_functions.cpp
+1
-0
zones_polygons_insulated_copper_islands.cpp
pcbnew/zones_polygons_insulated_copper_islands.cpp
+1
-0
zones_polygons_test_connections.cpp
pcbnew/zones_polygons_test_connections.cpp
+1
-1
zones_test_and_combine_areas.cpp
pcbnew/zones_test_and_combine_areas.cpp
+9
-8
PolyLine.cpp
polygon/PolyLine.cpp
+18
-230
PolyLine.h
polygon/PolyLine.h
+4
-9
math_for_graphics.cpp
polygon/math_for_graphics.cpp
+21
-16
math_for_graphics.h
polygon/math_for_graphics.h
+1
-6
No files found.
pcbnew/class_pad.cpp
View file @
dfdd2cfd
...
...
@@ -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
...
...
pcbnew/class_zone.cpp
View file @
dfdd2cfd
...
...
@@ -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
)
:
...
...
pcbnew/drc_clearance_test_functions.cpp
View file @
dfdd2cfd
...
...
@@ -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
...
...
pcbnew/zones_polygons_insulated_copper_islands.cpp
View file @
dfdd2cfd
...
...
@@ -35,6 +35,7 @@
#include <pcbnew.h>
#include <zones.h>
#include <polygon_test_point_inside.h>
/**
...
...
pcbnew/zones_polygons_test_connections.cpp
View file @
dfdd2cfd
...
...
@@ -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
);
...
...
pcbnew/zones_test_and_combine_areas.cpp
View file @
dfdd2cfd
...
...
@@ -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
);
...
...
polygon/PolyLine.cpp
View file @
dfdd2cfd
This diff is collapsed.
Click to expand it.
polygon/PolyLine.h
View file @
dfdd2cfd
...
...
@@ -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
};
...
...
polygon/math_for_graphics.cpp
View file @
dfdd2cfd
...
...
@@ -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
;
...
...
polygon/math_for_graphics.h
View file @
dfdd2cfd
// 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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment