Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
1c26be90
Commit
1c26be90
authored
Mar 03, 2018
by
Davis King
Browse files
Added operator + support for dlib.rectangle.
parent
4e01b779
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
tools/python/src/rectangles.cpp
tools/python/src/rectangles.cpp
+28
-0
No files found.
tools/python/src/rectangles.cpp
View file @
1c26be90
...
...
@@ -68,6 +68,30 @@ string print_rectangle_repr(const rect_type& r)
return
sout
.
str
();
}
rectangle
add_point_to_rect
(
const
rectangle
&
r
,
const
point
&
p
)
{
return
r
+
p
;
}
rectangle
add_rect_to_rect
(
const
rectangle
&
r
,
const
rectangle
&
p
)
{
return
r
+
p
;
}
rectangle
&
iadd_point_to_rect
(
rectangle
&
r
,
const
point
&
p
)
{
r
+=
p
;
return
r
;
}
rectangle
&
iadd_rect_to_rect
(
rectangle
&
r
,
const
rectangle
&
p
)
{
r
+=
p
;
return
r
;
}
// ----------------------------------------------------------------------------------------
void
bind_rectangles
(
py
::
module
&
m
)
...
...
@@ -92,6 +116,10 @@ void bind_rectangles(py::module& m)
.
def
(
"intersect"
,
&::
intersect
<
type
>
,
py
::
arg
(
"rectangle"
))
.
def
(
"__str__"
,
&::
print_rectangle_str
<
type
>
)
.
def
(
"__repr__"
,
&::
print_rectangle_repr
<
type
>
)
.
def
(
"__add__"
,
&::
add_point_to_rect
)
.
def
(
"__add__"
,
&::
add_rect_to_rect
)
.
def
(
"__iadd__"
,
&::
iadd_point_to_rect
)
.
def
(
"__iadd__"
,
&::
iadd_rect_to_rect
)
.
def
(
py
::
self
==
py
::
self
)
.
def
(
py
::
self
!=
py
::
self
)
.
def
(
py
::
pickle
(
&
getstate
<
type
>
,
&
setstate
<
type
>
));
...
...
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