Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
862d5a4b
Commit
862d5a4b
authored
Jul 26, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added scalar addition and subtraction operators.
parent
2ee99f74
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
+44
-0
vector2d.h
include/math/vector2d.h
+44
-0
No files found.
include/math/vector2d.h
View file @
862d5a4b
...
...
@@ -215,15 +215,27 @@ public:
/// Vector addition operator
VECTOR2
<
T
>
operator
+
(
const
VECTOR2
<
T
>&
aVector
)
const
;
/// Scalar addition operator
VECTOR2
<
T
>
operator
+
(
const
T
&
aScalar
)
const
;
/// Compound assignment operator
VECTOR2
<
T
>&
operator
+=
(
const
VECTOR2
<
T
>&
aVector
);
/// Compound assignment operator
VECTOR2
<
T
>&
operator
+=
(
const
T
&
aScalar
);
/// Vector subtraction operator
VECTOR2
<
T
>
operator
-
(
const
VECTOR2
<
T
>&
aVector
)
const
;
/// Scalar subtraction operator
VECTOR2
<
T
>
operator
-
(
const
T
&
aScalar
)
const
;
/// Compound assignment operator
VECTOR2
<
T
>&
operator
-=
(
const
VECTOR2
<
T
>&
aVector
);
/// Compound assignment operator
VECTOR2
<
T
>&
operator
-=
(
const
T
&
aScalar
);
/// Negate Vector operator
VECTOR2
<
T
>
operator
-
();
...
...
@@ -330,6 +342,15 @@ VECTOR2<T>& VECTOR2<T>::operator+=( const VECTOR2<T>& aVector )
}
template
<
class
T
>
VECTOR2
<
T
>&
VECTOR2
<
T
>::
operator
+=
(
const
T
&
aScalar
)
{
x
+=
aScalar
;
y
+=
aScalar
;
return
*
this
;
}
template
<
class
T
>
VECTOR2
<
T
>&
VECTOR2
<
T
>::
operator
-=
(
const
VECTOR2
<
T
>&
aVector
)
{
...
...
@@ -339,6 +360,15 @@ VECTOR2<T>& VECTOR2<T>::operator-=( const VECTOR2<T>& aVector )
}
template
<
class
T
>
VECTOR2
<
T
>&
VECTOR2
<
T
>::
operator
-=
(
const
T
&
aScalar
)
{
x
-=
aScalar
;
y
-=
aScalar
;
return
*
this
;
}
template
<
class
T
>
int
VECTOR2
<
T
>::
LineSide
(
const
VECTOR2
<
T
>&
aStart
,
const
VECTOR2
<
T
>&
aEnd
)
const
{
...
...
@@ -463,6 +493,13 @@ VECTOR2<T> VECTOR2<T>::operator+( const VECTOR2<T>& aVector ) const
}
template
<
class
T
>
VECTOR2
<
T
>
VECTOR2
<
T
>::
operator
+
(
const
T
&
aScalar
)
const
{
return
VECTOR2
<
T
>
(
x
+
aScalar
,
y
+
aScalar
);
}
template
<
class
T
>
VECTOR2
<
T
>
VECTOR2
<
T
>::
operator
-
(
const
VECTOR2
<
T
>&
aVector
)
const
{
...
...
@@ -470,6 +507,13 @@ VECTOR2<T> VECTOR2<T>::operator-( const VECTOR2<T>& aVector ) const
}
template
<
class
T
>
VECTOR2
<
T
>
VECTOR2
<
T
>::
operator
-
(
const
T
&
aScalar
)
const
{
return
VECTOR2
<
T
>
(
x
-
aScalar
,
y
-
aScalar
);
}
template
<
class
T
>
VECTOR2
<
T
>
VECTOR2
<
T
>::
operator
-
()
{
...
...
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