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
6559d6a5
Commit
6559d6a5
authored
Nov 30, 2012
by
Marco Mattila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix pcbnew zone corner filleting
parent
23c1c4a0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
6 deletions
+3
-6
PolyLine.cpp
polygon/PolyLine.cpp
+3
-6
No files found.
polygon/PolyLine.cpp
View file @
6559d6a5
...
@@ -450,15 +450,15 @@ CPolyLine* CPolyLine::Fillet( unsigned int aRadius, unsigned int aSegments )
...
@@ -450,15 +450,15 @@ CPolyLine* CPolyLine::Fillet( unsigned int aRadius, unsigned int aSegments )
double
lenb
=
sqrt
(
(
double
)
(
xb
*
xb
+
yb
*
yb
)
);
double
lenb
=
sqrt
(
(
double
)
(
xb
*
xb
+
yb
*
yb
)
);
double
cosine
=
(
xa
*
xb
+
ya
*
yb
)
/
(
lena
*
lenb
);
double
cosine
=
(
xa
*
xb
+
ya
*
yb
)
/
(
lena
*
lenb
);
unsigned
int
radius
=
aRadius
;
double
radius
=
aRadius
;
double
denom
=
sqrt
(
2.0
/
(
1
+
cosine
)
-
1
);
double
denom
=
sqrt
(
2.0
/
(
1
+
cosine
)
-
1
);
// Limit rounding distance to one half of an edge
// Limit rounding distance to one half of an edge
if
(
0.5
*
lena
*
denom
<
radius
)
if
(
0.5
*
lena
*
denom
<
radius
)
radius
=
(
unsigned
int
)
(
0.5
*
lena
*
denom
)
;
radius
=
0.5
*
lena
*
denom
;
if
(
0.5
*
lenb
*
denom
<
radius
)
if
(
0.5
*
lenb
*
denom
<
radius
)
radius
=
(
unsigned
int
)
(
0.5
*
lenb
*
denom
)
;
radius
=
0.5
*
lenb
*
denom
;
// Calculate fillet arc absolute center point (xc, yx)
// Calculate fillet arc absolute center point (xc, yx)
double
k
=
radius
/
sqrt
(
.5
*
(
1
-
cosine
)
);
double
k
=
radius
/
sqrt
(
.5
*
(
1
-
cosine
)
);
...
@@ -507,14 +507,11 @@ CPolyLine* CPolyLine::Fillet( unsigned int aRadius, unsigned int aSegments )
...
@@ -507,14 +507,11 @@ CPolyLine* CPolyLine::Fillet( unsigned int aRadius, unsigned int aSegments )
else
else
newPoly
->
AppendCorner
(
(
int
)
nx
,
(
int
)
ny
);
newPoly
->
AppendCorner
(
(
int
)
nx
,
(
int
)
ny
);
unsigned
int
nVertices
=
0
;
for
(
unsigned
int
j
=
0
;
j
<
segments
;
j
++
)
for
(
unsigned
int
j
=
0
;
j
<
segments
;
j
++
)
{
{
nx
=
xc
+
cos
(
startAngle
+
(
j
+
1
)
*
deltaAngle
)
*
radius
+
0.5
;
nx
=
xc
+
cos
(
startAngle
+
(
j
+
1
)
*
deltaAngle
)
*
radius
+
0.5
;
ny
=
yc
-
sin
(
startAngle
+
(
j
+
1
)
*
deltaAngle
)
*
radius
+
0.5
;
ny
=
yc
-
sin
(
startAngle
+
(
j
+
1
)
*
deltaAngle
)
*
radius
+
0.5
;
newPoly
->
AppendCorner
(
(
int
)
nx
,
(
int
)
ny
);
newPoly
->
AppendCorner
(
(
int
)
nx
,
(
int
)
ny
);
nVertices
++
;
}
}
}
}
...
...
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