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
90228980
Commit
90228980
authored
Sep 07, 2009
by
diemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added DRC check for rotated rectangular pads
parent
7c7d675c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
3 deletions
+58
-3
drc.cpp
pcbnew/drc.cpp
+58
-3
No files found.
pcbnew/drc.cpp
View file @
90228980
...
@@ -1054,6 +1054,15 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, LISTE_PAD* aStart, LISTE_PAD* aEnd,
...
@@ -1054,6 +1054,15 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, LISTE_PAD* aStart, LISTE_PAD* aEnd,
}
}
// Rotate a vector by an angle
wxPoint
rotate
(
wxPoint
p
,
int
angle
){
wxPoint
n
;
float
theta
=
M_PI
*
angle
/
1800
;
n
.
x
=
float
(
p
.
x
)
*
cos
(
theta
)
-
float
(
p
.
y
)
*
sin
(
theta
);
n
.
y
=
p
.
x
*
sin
(
theta
)
+
p
.
y
*
cos
(
theta
);
return
n
;
}
/**************************************************************************************/
/**************************************************************************************/
bool
DRC
::
checkClearancePadToPad
(
D_PAD
*
aRefPad
,
D_PAD
*
aPad
,
const
int
dist_min
)
bool
DRC
::
checkClearancePadToPad
(
D_PAD
*
aRefPad
,
D_PAD
*
aPad
,
const
int
dist_min
)
/***************************************************************************************/
/***************************************************************************************/
...
@@ -1075,8 +1084,7 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad, const int dist_mi
...
@@ -1075,8 +1084,7 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad, const int dist_mi
bool
diag
=
true
;
bool
diag
=
true
;
/* tst rapide: si les cercles exinscrits sont distants de dist_min au moins,
/* Quick test: Clearance is OK if the bounding circles are further away than dist_min.*/
* il n'y a pas de risque: */
if
(
(
dist
-
aRefPad
->
m_Rayon
-
aPad
->
m_Rayon
)
>=
dist_min
)
if
(
(
dist
-
aRefPad
->
m_Rayon
-
aPad
->
m_Rayon
)
>=
dist_min
)
goto
exit
;
goto
exit
;
...
@@ -1143,8 +1151,55 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad, const int dist_mi
...
@@ -1143,8 +1151,55 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad, const int dist_mi
}
}
else
// Any other orient
else
// Any other orient
{
{
/* TODO : any orient ... */
/* Use TestForIntersectionOfStraightLineSegments() for all 4 edges (segments).*/
/* Test if one center point is contained in the other and thus the pads overlap.
* This case is not covered by the following check if one pad is
* completely contained in the other (because edges don't intersect)!
*/
if
(
(
(
dist
<
aPad
->
m_Size
.
x
)
&&
(
dist
<
aPad
->
m_Size
.
y
)
)
||
(
(
dist
<
aRefPad
->
m_Size
.
x
)
&&
(
dist
<
aRefPad
->
m_Size
.
y
)
)){
diag
=
false
;
}
// Vectors from center to corner
wxPoint
aPad_c2c
=
wxPoint
(
aPad
->
m_Size
.
x
/
2
,
aPad
->
m_Size
.
y
/
2
);
wxPoint
aRefPad_c2c
=
wxPoint
(
aRefPad
->
m_Size
.
x
/
2
,
aRefPad
->
m_Size
.
y
/
2
);
for
(
int
i
=
0
;
i
<
4
;
i
++
){
// for all edges in aPad
wxPoint
p11
=
aPad
->
ReturnShapePos
()
+
rotate
(
aPad_c2c
,
aPad
->
m_Orient
);
// flip the center-to-corner vector
if
(
i
%
2
==
0
){
aPad_c2c
.
x
=
-
aPad_c2c
.
x
;
}
else
{
aPad_c2c
.
y
=
-
aPad_c2c
.
y
;
}
wxPoint
p12
=
aPad
->
ReturnShapePos
()
+
rotate
(
aPad_c2c
,
aPad
->
m_Orient
);
for
(
int
j
=
0
;
j
<
4
;
j
++
){
// for all edges in aRefPad
wxPoint
p21
=
aRefPad
->
ReturnShapePos
()
+
rotate
(
aRefPad_c2c
,
aRefPad
->
m_Orient
);
// flip the center-to-corner vector
if
(
j
%
2
==
0
){
aRefPad_c2c
.
x
=
-
aRefPad_c2c
.
x
;
}
else
{
aRefPad_c2c
.
y
=
-
aRefPad_c2c
.
y
;
}
wxPoint
p22
=
aRefPad
->
ReturnShapePos
()
+
rotate
(
aRefPad_c2c
,
aRefPad
->
m_Orient
);
int
x
,
y
;
double
d
;
int
intersect
=
TestForIntersectionOfStraightLineSegments
(
p11
.
x
,
p11
.
y
,
p12
.
x
,
p12
.
y
,
p21
.
x
,
p21
.
y
,
p22
.
x
,
p22
.
y
,
&
x
,
&
y
,
&
d
);
;
if
(
intersect
||
(
d
<
dist_min
)){
diag
=
false
;
}
}
}
}
}
}
else
{
// TODO: Pad -> other shape!
}
}
break
;
break
;
...
...
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