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
d786ac91
Commit
d786ac91
authored
Jul 26, 2013
by
matheiulj
Committed by
Wayne Stambaugh
Jul 26, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix pad bounding box calculation bug. (fixes lp:1202828)
parent
cb52b9d0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
4 deletions
+69
-4
class_pad.cpp
pcbnew/class_pad.cpp
+69
-4
No files found.
pcbnew/class_pad.cpp
View file @
d786ac91
...
@@ -123,12 +123,77 @@ int D_PAD::boundingRadius() const
...
@@ -123,12 +123,77 @@ int D_PAD::boundingRadius() const
EDA_RECT
D_PAD
::
GetBoundingBox
()
const
EDA_RECT
D_PAD
::
GetBoundingBox
()
const
{
{
EDA_RECT
area
;
EDA_RECT
area
;
wxPoint
quadrant1
,
quadrant2
,
quadrant3
,
quadrant4
;
int
x
,
y
,
dx
,
dy
;
// radius of pad area, enclosed in minimum sized circle
switch
(
GetShape
()
)
int
radius
=
boundingRadius
();
{
case
PAD_CIRCLE
:
area
.
SetOrigin
(
m_Pos
);
area
.
Inflate
(
m_Size
.
x
/
2
);
break
;
area
.
SetOrigin
(
m_Pos
);
case
PAD_OVAL
:
area
.
Inflate
(
radius
);
//Use the maximal two most distant points and track their rotation
// (utilise symmetry to avoid four points)
quadrant1
.
x
=
m_Size
.
x
/
2
;
quadrant1
.
y
=
0
;
quadrant2
.
x
=
0
;
quadrant2
.
y
=
m_Size
.
y
/
2
;
RotatePoint
(
&
quadrant1
,
m_Orient
);
RotatePoint
(
&
quadrant2
,
m_Orient
);
dx
=
std
::
max
(
std
::
abs
(
quadrant1
.
x
)
,
std
::
abs
(
quadrant2
.
x
)
);
dy
=
std
::
max
(
std
::
abs
(
quadrant1
.
y
)
,
std
::
abs
(
quadrant2
.
y
)
);
area
.
SetOrigin
(
m_Pos
.
x
-
dx
,
m_Pos
.
y
-
dy
);
area
.
SetSize
(
2
*
dx
,
2
*
dy
);
break
;
break
;
case
PAD_RECT
:
//Use two corners and track their rotation
// (utilise symmetry to avoid four points)
quadrant1
.
x
=
m_Size
.
x
/
2
;
quadrant1
.
y
=
m_Size
.
y
/
2
;
quadrant2
.
x
=
-
m_Size
.
x
/
2
;
quadrant2
.
y
=
m_Size
.
y
/
2
;
RotatePoint
(
&
quadrant1
,
m_Orient
);
RotatePoint
(
&
quadrant2
,
m_Orient
);
dx
=
std
::
max
(
std
::
abs
(
quadrant1
.
x
)
,
std
::
abs
(
quadrant2
.
x
)
);
dy
=
std
::
max
(
std
::
abs
(
quadrant1
.
y
)
,
std
::
abs
(
quadrant2
.
y
)
);
area
.
SetOrigin
(
m_Pos
.
x
-
dx
,
m_Pos
.
y
-
dy
);
area
.
SetSize
(
2
*
dx
,
2
*
dy
);
break
;
case
PAD_TRAPEZOID
:
//Use the four corners and track their rotation
// (Trapezoids will not be symmetric)
quadrant1
.
x
=
(
m_Size
.
x
+
m_DeltaSize
.
y
)
/
2
;
quadrant1
.
y
=
(
m_Size
.
y
-
m_DeltaSize
.
x
)
/
2
;
quadrant2
.
x
=
-
(
m_Size
.
x
+
m_DeltaSize
.
y
)
/
2
;
quadrant2
.
y
=
(
m_Size
.
y
+
m_DeltaSize
.
x
)
/
2
;
quadrant3
.
x
=
-
(
m_Size
.
x
-
m_DeltaSize
.
y
)
/
2
;
quadrant3
.
y
=
-
(
m_Size
.
y
+
m_DeltaSize
.
x
)
/
2
;
quadrant4
.
x
=
(
m_Size
.
x
-
m_DeltaSize
.
y
)
/
2
;
quadrant4
.
y
=
-
(
m_Size
.
y
-
m_DeltaSize
.
x
)
/
2
;
RotatePoint
(
&
quadrant1
,
m_Orient
);
RotatePoint
(
&
quadrant2
,
m_Orient
);
RotatePoint
(
&
quadrant3
,
m_Orient
);
RotatePoint
(
&
quadrant4
,
m_Orient
);
x
=
std
::
min
(
quadrant1
.
x
,
std
::
min
(
quadrant2
.
x
,
std
::
min
(
quadrant3
.
x
,
quadrant4
.
x
)
)
);
y
=
std
::
min
(
quadrant1
.
y
,
std
::
min
(
quadrant2
.
y
,
std
::
min
(
quadrant3
.
y
,
quadrant4
.
y
)
)
);
dx
=
std
::
max
(
quadrant1
.
x
,
std
::
max
(
quadrant2
.
x
,
std
::
max
(
quadrant3
.
x
,
quadrant4
.
x
)
)
);
dy
=
std
::
max
(
quadrant1
.
y
,
std
::
max
(
quadrant2
.
y
,
std
::
max
(
quadrant3
.
y
,
quadrant4
.
y
)
)
);
area
.
SetOrigin
(
m_Pos
.
x
+
x
,
m_Pos
.
y
+
y
);
area
.
SetSize
(
dx
-
x
,
dy
-
y
);
break
;
default
:
break
;
}
return
area
;
return
area
;
}
}
...
...
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