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
a4d6ca68
Commit
a4d6ca68
authored
Apr 05, 2013
by
André Reichenbach
Browse files
[ADD] dataset manipulator now also transforms point data
parent
c3a40f14
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
src/modules/datasetManipulator/WMDatasetManipulator.cpp
src/modules/datasetManipulator/WMDatasetManipulator.cpp
+26
-0
No files found.
src/modules/datasetManipulator/WMDatasetManipulator.cpp
View file @
a4d6ca68
...
...
@@ -33,6 +33,7 @@
#include "core/dataHandler/WDataSetSingle.h"
#include "core/dataHandler/WDataSetFibers.h"
#include "core/dataHandler/WDataSetPoints.h"
#include "core/graphicsEngine/WTriangleMesh.h"
#include "WManipulatorTranslation.h"
...
...
@@ -207,6 +208,27 @@ boost::shared_ptr< WDataSet > WMDatasetManipulator::transformData( WMatrixFixed<
return
data
;
}
boost
::
shared_ptr
<
WDataSetPoints
>
asPoints
=
boost
::
dynamic_pointer_cast
<
WDataSetPoints
>
(
m_data
);
if
(
asPoints
)
{
boost
::
shared_ptr
<
std
::
vector
<
float
>
>
p
(
new
std
::
vector
<
float
>
(
asPoints
->
getVertices
()
->
size
()
)
);
for
(
std
::
size_t
k
=
0
;
k
<
asPoints
->
getVertices
()
->
size
();
k
+=
3
)
{
WVector4d
vec
(
asPoints
->
getVertices
()
->
operator
[](
k
+
0
),
asPoints
->
getVertices
()
->
operator
[](
k
+
1
),
asPoints
->
getVertices
()
->
operator
[](
k
+
2
),
1.0
);
vec
=
mat
*
vec
;
p
->
operator
[]
(
k
+
0
)
=
vec
[
0
];
p
->
operator
[]
(
k
+
1
)
=
vec
[
1
];
p
->
operator
[]
(
k
+
2
)
=
vec
[
2
];
}
return
boost
::
shared_ptr
<
WDataSetPoints
>
(
new
WDataSetPoints
(
p
,
asPoints
->
getColors
()
)
);
}
return
boost
::
shared_ptr
<
WDataSet
>
();
}
...
...
@@ -227,4 +249,8 @@ void WMDatasetManipulator::initMatrix()
{
m_currentMat
=
WMatrixFixed
<
double
,
4
,
4
>::
identity
();
}
else
if
(
boost
::
dynamic_pointer_cast
<
WDataSetPoints
>
(
m_data
)
)
{
m_currentMat
=
WMatrixFixed
<
double
,
4
,
4
>::
identity
();
}
}
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