Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
6c750a48
Commit
6c750a48
authored
Mar 01, 2010
by
Mathias Goldau
Browse files
[MERGE]
parents
36953055
93e92791
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
75 additions
and
0 deletions
+75
-0
src/math/WLine.h
src/math/WLine.h
+11
-0
src/math/test/WLine_test.h
src/math/test/WLine_test.h
+43
-0
src/modules/eegView/eeg.png
src/modules/eegView/eeg.png
+0
-0
src/modules/eegView/eeg.xpm
src/modules/eegView/eeg.xpm
+21
-0
No files found.
src/math/WLine.h
View file @
6c750a48
...
...
@@ -76,6 +76,17 @@ namespace wmath
* \return Sum of all line segment lengths
*/
double
pathLength
()
const
;
/**
* Returns the point in the middle of the line. In case of an even sized
* line the mid point is the same as if there were only size()-1 many
* elements present.
*
* \throws WOutOfBounds In case its called on an empty line
*
* \return Const reference to the midpoint element.
*/
const
wmath
::
WPosition
&
midPoint
()
const
;
};
}
// end of namespace
#endif // WLINE_H
src/math/test/WLine_test.h
View file @
6c750a48
...
...
@@ -226,6 +226,49 @@ public:
// assert_SAMELINES( expected, line );
// }
/**
* The mid point of a WLine is just the point in the middle of the line.
* For lines with even numbered size the element before that non existing
* midPoint is selected.
*/
void
testMidPointOnEvenSize
(
void
)
{
using
wmath
::
WPosition
;
wmath
::
WLine
line
;
line
.
push_back
(
WPosition
(
0
,
0
,
0
)
);
line
.
push_back
(
WPosition
(
1
,
1
,
0
)
);
line
.
push_back
(
WPosition
(
2
,
0
,
0
)
);
line
.
push_back
(
WPosition
(
3
,
1
,
0
)
);
WPosition
expected
(
1
,
1
,
0
);
TS_ASSERT_EQUALS
(
expected
,
WPosition
(
line
.
midPoint
()
)
);
}
/**
* When a line has uneven numbered size, the mid point is unique.
*/
void
testMidPointOnUnevenSize
(
void
)
{
using
wmath
::
WPosition
;
wmath
::
WLine
line
;
line
.
push_back
(
WPosition
(
0
,
0
,
0
)
);
line
.
push_back
(
WPosition
(
1
,
1
,
0
)
);
line
.
push_back
(
WPosition
(
2
,
0
,
0
)
);
WPosition
expected
(
1
,
1
,
0
);
TS_ASSERT_EQUALS
(
expected
,
WPosition
(
line
.
midPoint
()
)
);
}
/**
* When calling midPoint on empty lines => there is no point to return
* hence an exception is generated.
*/
void
testMidPointOnEmptyLine
(
void
)
{
using
wmath
::
WPosition
;
wmath
::
WLine
line
;
WPosition
expected
(
1
,
1
,
0
);
TS_ASSERT_THROWS_EQUALS
(
line
.
midPoint
(),
WOutOfBounds
&
e
,
std
::
string
(
e
.
what
()
),
"There is no midpoint for an empty line."
);
}
private:
/**
* TS_ASSERT_DELTA needs the operator+, operator- and operator< to be implemented especially for WPositions the operator< and operator +
...
...
src/modules/eegView/eeg.png
0 → 100644
View file @
6c750a48
160 Bytes
src/modules/eegView/eeg.xpm
0 → 100644
View file @
6c750a48
/* XPM */
static const char * eeg_xpm[] = {
"16 16 2 1",
" c None",
". c #000000",
" ... ",
". ... . ",
" . . ....",
" ... ",
" . ",
" . . ",
". . . ",
" . . . .",
" .... . . ",
" . . ",
" . ",
" ",
" .... ",
". . . ",
" ... . ...",
" .. "};
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