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
35724d0a
Commit
35724d0a
authored
Feb 20, 2010
by
cornimueller
Browse files
[ADD] EEG View module now displays the head surface using a delaunay triangulation
parent
9aa533c3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
0 deletions
+34
-0
src/modules/eegView/WMEEGView.cpp
src/modules/eegView/WMEEGView.cpp
+34
-0
No files found.
src/modules/eegView/WMEEGView.cpp
View file @
35724d0a
...
...
@@ -24,6 +24,8 @@
#include <string>
#include <osgUtil/DelaunayTriangulator>
#include "../../graphicsEngine/WGEUtils.h"
#include "../../kernel/WKernel.h"
#include "WMEEGView.h"
...
...
@@ -340,6 +342,38 @@ void WMEEGView::redraw()
m_rootNode3d
->
addChild
(
textGeode
);
}
// draw head surface
osg
::
ref_ptr
<
osg
::
Vec3Array
>
positions
(
new
osg
::
Vec3Array
);
for
(
size_t
channel
=
0
;
channel
<
nbChannels
;
++
channel
)
{
positions
->
push_back
(
wge
::
osgVec3
(
m_eeg
->
getChannelPosition
(
channel
)
)
);
}
osg
::
ref_ptr
<
osg
::
Vec3Array
>
normals
(
new
osg
::
Vec3Array
);
osg
::
ref_ptr
<
osgUtil
::
DelaunayTriangulator
>
triangulator
(
new
osgUtil
::
DelaunayTriangulator
(
positions
,
normals
)
);
if
(
triangulator
->
triangulate
()
)
{
osg
::
Geometry
*
geometry
=
new
osg
::
Geometry
;
geometry
->
setVertexArray
(
positions
);
geometry
->
setNormalArray
(
normals
);
geometry
->
setNormalBinding
(
osg
::
Geometry
::
BIND_PER_PRIMITIVE
);
osg
::
Vec4Array
*
colors
=
new
osg
::
Vec4Array
;
colors
->
push_back
(
osg
::
Vec4
(
1.0
,
1.0
,
1.0
,
1.0
)
);
geometry
->
setColorArray
(
colors
);
geometry
->
setColorBinding
(
osg
::
Geometry
::
BIND_OVERALL
);
geometry
->
addPrimitiveSet
(
triangulator
->
getTriangles
()
);
osg
::
Geode
*
geode
=
new
osg
::
Geode
;
geode
->
addDrawable
(
geometry
);
m_rootNode3d
->
addChild
(
geode
);
}
else
{
errorLog
()
<<
"Couldn't triangulate head surface"
;
}
if
(
m_wasActive
)
{
debugLog
()
<<
"Adding rootNode to scene after redraw"
;
...
...
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