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
6639c2d8
Commit
6639c2d8
authored
Sep 09, 2013
by
tomasz.wlostowski@cern.ch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
math/box2.h: normalize on construction, minor compilation warning fix
parent
f4ec1e72
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
box2.h
include/math/box2.h
+7
-5
No files found.
include/math/box2.h
View file @
6639c2d8
...
...
@@ -66,7 +66,9 @@ public:
BOX2
(
const
Vec
&
aPos
,
const
Vec
&
aSize
)
:
m_Pos
(
aPos
),
m_Size
(
aSize
)
{
}
{
Normalize
();
}
void
SetMaximum
()
{
...
...
@@ -416,10 +418,10 @@ public:
{
ecoord_type
x2
=
m_Pos
.
x
+
m_Size
.
x
;
ecoord_type
y2
=
m_Pos
.
y
+
m_Size
.
y
;
ecoord_type
xdiff
=
std
::
max
(
aP
.
x
<
m_Pos
.
x
?
m_Pos
.
x
-
aP
.
x
:
m_Pos
.
x
-
x2
,
0
);
ecoord_type
ydiff
=
std
::
max
(
aP
.
y
<
m_Pos
.
y
?
m_Pos
.
y
-
aP
.
y
:
m_Pos
.
y
-
y2
,
0
);
return
xdiff
*
xdiff
+
ydiff
*
ydiff
;
}
ecoord_type
xdiff
=
std
::
max
(
aP
.
x
<
m_Pos
.
x
?
m_Pos
.
x
-
aP
.
x
:
m_Pos
.
x
-
x2
,
(
ecoord_type
)
0
);
ecoord_type
ydiff
=
std
::
max
(
aP
.
y
<
m_Pos
.
y
?
m_Pos
.
y
-
aP
.
y
:
m_Pos
.
y
-
y2
,
(
ecoord_type
)
0
);
return
xdiff
*
xdiff
+
ydiff
*
ydiff
;
}
ecoord_type
Distance
(
const
Vec
&
aP
)
const
{
...
...
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