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
c7fa57fa
Commit
c7fa57fa
authored
Mar 12, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed the way of handling BOX2 traits (used std::numeric_limits).
parent
1e04f3b9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
20 deletions
+6
-20
box2.h
include/math/box2.h
+6
-20
No files found.
include/math/box2.h
View file @
c7fa57fa
...
...
@@ -28,24 +28,9 @@
#define __BOX2_H
#include <math/vector2d.h>
#include <limits>
template
<
class
Vec
>
class
BOX2_TRAITS
{
};
template
<>
class
BOX2_TRAITS
<
VECTOR2I
>
{
public
:
enum
{
c_max_size
=
INT_MAX
-
1
,
c_min_coord_value
=
INT_MIN
/
2
+
1
};
};
/**
* Class BOX2
* handles a 2-D bounding box, built on top of an origin point
...
...
@@ -59,8 +44,9 @@ private:
Vec
m_Size
;
// Rectangle Size
public
:
typedef
typename
Vec
::
coord_type
coord_type
;
typedef
typename
Vec
::
extended_type
ecoord_type
;
typedef
typename
Vec
::
coord_type
coord_type
;
typedef
typename
Vec
::
extended_type
ecoord_type
;
typedef
typename
std
::
numeric_limits
<
coord_type
>
coord_limits
;
BOX2
()
{};
...
...
@@ -73,8 +59,8 @@ public:
void
SetMaximum
()
{
m_Pos
.
x
=
m_Pos
.
y
=
BOX2_TRAITS
<
Vec
>
().
c_min_coord_value
;
m_Size
.
x
=
m_Size
.
y
=
BOX2_TRAITS
<
Vec
>
().
c_max_size
;
m_Pos
.
x
=
m_Pos
.
y
=
coord_limits
::
min
()
/
2
+
coord_limits
::
epsilon
()
;
m_Size
.
x
=
m_Size
.
y
=
coord_limits
::
max
()
-
coord_limits
::
epsilon
()
;
}
Vec
Centre
()
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