Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Pierre NARVOR
rtac_base
Commits
135249e7
Commit
135249e7
authored
Oct 28, 2021
by
Pierre NARVOR
Browse files
[types] Added a Bounds type
parent
13b23647
Changes
2
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
135249e7
...
...
@@ -16,6 +16,7 @@ list(APPEND rtac_base_headers
include/rtac_base/types/Handle.h
include/rtac_base/types/Shape.h
include/rtac_base/types/Rectangle.h
include/rtac_base/types/Bounds.h
include/rtac_base/types/common.h
include/rtac_base/types/Pose.h
include/rtac_base/types/Point.h
...
...
include/rtac_base/types/Bounds.h
0 → 100644
View file @
135249e7
#ifndef _DEF_RTAC_BASE_TYPES_BOUNDS_H_
#define _DEF_RTAC_BASE_TYPES_BOUNDS_H_
#include <iostream>
#include <array>
namespace
rtac
{
namespace
types
{
template
<
typename
T
>
struct
Interval
{
T
min
;
T
max
;
T
length
()
const
{
return
this
->
max
-
this
->
min
;
}
};
template
<
typename
T
,
std
::
size_t
N
>
using
Bounds
=
std
::
array
<
Interval
<
T
>
,
N
>
;
};
//namespace types
};
//namespace rtac
template
<
typename
T
>
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
rtac
::
types
::
Interval
<
T
>&
interval
)
{
os
<<
"(min : "
<<
interval
.
min
<<
", max : "
<<
interval
.
max
<<
")"
;
return
os
;
}
template
<
typename
T
,
std
::
size_t
N
>
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
rtac
::
types
::
Bounds
<
T
,
N
>&
bounds
)
{
for
(
auto
&
i
:
bounds
)
{
os
<<
i
<<
std
::
endl
;
}
return
os
;
}
#endif //_DEF_RTAC_BASE_TYPES_BOUNDS_H_
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