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
d2fa9e85
"git@developer.sourcefind.cn:OpenDAS/ollama.git" did not exist on "1bd594b2fab7a6945f90df2e7caa4d5701d4a48e"
Commit
d2fa9e85
authored
May 26, 2018
by
Davis King
Browse files
Cleaned up code and fixed point and dpoint addition actually doing subtraction.
parent
bef30d18
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
31 deletions
+8
-31
tools/python/src/rectangles.cpp
tools/python/src/rectangles.cpp
+4
-27
tools/python/src/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