Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
0eb1c7ed
Commit
0eb1c7ed
authored
Aug 22, 2014
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3127 from GravityJack:size-math-ops
parents
b56933d9
17e8d511
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
6 deletions
+35
-6
types.hpp
modules/core/include/opencv2/core/types.hpp
+35
-6
No files found.
modules/core/include/opencv2/core/types.hpp
View file @
0eb1c7ed
...
...
@@ -1311,23 +1311,36 @@ _Tp Size_<_Tp>::area() const
return
width
*
height
;
}
template
<
typename
_Tp
>
static
inline
Size_
<
_Tp
>&
operator
*=
(
Size_
<
_Tp
>&
a
,
_Tp
b
)
{
a
.
width
*=
b
;
a
.
height
*=
b
;
return
a
;
}
template
<
typename
_Tp
>
static
inline
Size_
<
_Tp
>
operator
*
(
const
Size_
<
_Tp
>&
a
,
_Tp
b
)
{
return
Size_
<
_Tp
>
(
a
.
width
*
b
,
a
.
height
*
b
);
Size_
<
_Tp
>
tmp
(
a
);
tmp
*=
b
;
return
tmp
;
}
template
<
typename
_Tp
>
static
inline
Size_
<
_Tp
>
operator
+
(
const
Size_
<
_Tp
>&
a
,
const
Size_
<
_Tp
>&
b
)
Size_
<
_Tp
>
&
operator
/=
(
Size_
<
_Tp
>&
a
,
_Tp
b
)
{
return
Size_
<
_Tp
>
(
a
.
width
+
b
.
width
,
a
.
height
+
b
.
height
);
a
.
width
/=
b
;
a
.
height
/=
b
;
return
a
;
}
template
<
typename
_Tp
>
static
inline
Size_
<
_Tp
>
operator
-
(
const
Size_
<
_Tp
>&
a
,
const
Size_
<
_Tp
>&
b
)
Size_
<
_Tp
>
operator
/
(
const
Size_
<
_Tp
>&
a
,
_Tp
b
)
{
return
Size_
<
_Tp
>
(
a
.
width
-
b
.
width
,
a
.
height
-
b
.
height
);
Size_
<
_Tp
>
tmp
(
a
);
tmp
/=
b
;
return
tmp
;
}
template
<
typename
_Tp
>
static
inline
...
...
@@ -1338,6 +1351,14 @@ Size_<_Tp>& operator += (Size_<_Tp>& a, const Size_<_Tp>& b)
return
a
;
}
template
<
typename
_Tp
>
static
inline
Size_
<
_Tp
>
operator
+
(
const
Size_
<
_Tp
>&
a
,
const
Size_
<
_Tp
>&
b
)
{
Size_
<
_Tp
>
tmp
(
a
);
tmp
+=
b
;
return
tmp
;
}
template
<
typename
_Tp
>
static
inline
Size_
<
_Tp
>&
operator
-=
(
Size_
<
_Tp
>&
a
,
const
Size_
<
_Tp
>&
b
)
{
...
...
@@ -1346,6 +1367,14 @@ Size_<_Tp>& operator -= (Size_<_Tp>& a, const Size_<_Tp>& b)
return
a
;
}
template
<
typename
_Tp
>
static
inline
Size_
<
_Tp
>
operator
-
(
const
Size_
<
_Tp
>&
a
,
const
Size_
<
_Tp
>&
b
)
{
Size_
<
_Tp
>
tmp
(
a
);
tmp
-=
b
;
return
tmp
;
}
template
<
typename
_Tp
>
static
inline
bool
operator
==
(
const
Size_
<
_Tp
>&
a
,
const
Size_
<
_Tp
>&
b
)
{
...
...
@@ -1355,7 +1384,7 @@ bool operator == (const Size_<_Tp>& a, const Size_<_Tp>& b)
template
<
typename
_Tp
>
static
inline
bool
operator
!=
(
const
Size_
<
_Tp
>&
a
,
const
Size_
<
_Tp
>&
b
)
{
return
a
.
width
!=
b
.
width
||
a
.
height
!=
b
.
height
;
return
!
(
a
==
b
)
;
}
...
...
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