Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
d2fa9e85
Commit
d2fa9e85
authored
May 26, 2018
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaned up code and fixed point and dpoint addition actually doing subtraction.
parent
bef30d18
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
31 deletions
+8
-31
rectangles.cpp
tools/python/src/rectangles.cpp
+4
-27
vector.cpp
tools/python/src/vector.cpp
+4
-4
No files found.
tools/python/src/rectangles.cpp
View file @
d2fa9e85
...
...
@@ -87,29 +87,6 @@ string print_rect_filter(const rect_filter& r)
}
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
;
}
// ----------------------------------------------------------------------------------------
...
...
@@ -142,10 +119,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
)
.
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
+=
point
()
)
.
def
(
py
::
self
+
point
()
)
.
def
(
py
::
self
+=
rectangle
()
)
.
def
(
py
::
self
+
rectangle
()
)
.
def
(
py
::
self
==
py
::
self
)
.
def
(
py
::
self
!=
py
::
self
)
.
def
(
py
::
pickle
(
&
getstate
<
type
>
,
&
setstate
<
type
>
));
...
...
tools/python/src/vector.cpp
View file @
d2fa9e85
...
...
@@ -405,8 +405,8 @@ void bind_vector(py::module& m)
.
def
(
py
::
init
<>
(
&
numpy_to_dlib_vect
<
double
>
),
py
::
arg
(
"v"
))
.
def
(
"__repr__"
,
&
point__repr__
)
.
def
(
"__str__"
,
&
point__str__
)
.
def
(
"__sub__"
,
[](
const
point
&
a
,
const
point
&
b
){
return
a
-
b
;}
)
.
def
(
"__add__"
,
[](
const
point
&
a
,
const
point
&
b
){
return
a
-
b
;}
)
.
def
(
py
::
self
+
py
::
self
)
.
def
(
py
::
self
-
py
::
self
)
.
def
(
"normalize"
,
&
type
::
normalize
,
"Returns a unit normalized copy of this vector."
)
.
def_property
(
"x"
,
&
point_x
,
[](
point
&
p
,
long
x
){
p
.
x
()
=
x
;},
"The x-coordinate of the point."
)
.
def_property
(
"y"
,
&
point_y
,
[](
point
&
p
,
long
y
){
p
.
x
()
=
y
;},
"The y-coordinate of the point."
)
...
...
@@ -434,8 +434,8 @@ void bind_vector(py::module& m)
.
def
(
"normalize"
,
&
type
::
normalize
,
"Returns a unit normalized copy of this vector."
)
.
def_property
(
"x"
,
&
dpoint_x
,
[](
dpoint
&
p
,
double
x
){
p
.
x
()
=
x
;},
"The x-coordinate of the dpoint."
)
.
def_property
(
"y"
,
&
dpoint_y
,
[](
dpoint
&
p
,
double
y
){
p
.
x
()
=
y
;},
"The y-coordinate of the dpoint."
)
.
def
(
"__sub__"
,
[](
const
dpoint
&
a
,
const
dpoint
&
b
){
return
a
-
b
;}
)
.
def
(
"__add__"
,
[](
const
dpoint
&
a
,
const
dpoint
&
b
){
return
a
-
b
;}
)
.
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