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
2f74a229
Commit
2f74a229
authored
Mar 12, 2010
by
Alexander Wiebel
Browse files
[ADD] marching cubes respects the coordinate transformations of the regular
grid now
parent
86c37cff
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
0 deletions
+28
-0
src/modules/marchingCubes/WMMarchingCubes.cpp
src/modules/marchingCubes/WMMarchingCubes.cpp
+22
-0
src/modules/marchingCubes/WMMarchingCubes.h
src/modules/marchingCubes/WMMarchingCubes.h
+6
-0
No files found.
src/modules/marchingCubes/WMMarchingCubes.cpp
View file @
2f74a229
...
@@ -47,6 +47,7 @@
...
@@ -47,6 +47,7 @@
#include "../../common/WProgress.h"
#include "../../common/WProgress.h"
#include "../../common/WPreferences.h"
#include "../../common/WPreferences.h"
#include "../../common/math/WVector3D.h"
#include "../../common/math/WVector3D.h"
#include "../../common/math/WLinearAlgebraFunctions.h"
#include "../../dataHandler/WDataHandler.h"
#include "../../dataHandler/WDataHandler.h"
#include "../../dataHandler/WSubject.h"
#include "../../dataHandler/WSubject.h"
#include "../../dataHandler/WGridRegular3D.h"
#include "../../dataHandler/WGridRegular3D.h"
...
@@ -250,6 +251,25 @@ void WMMarchingCubes::generateSurfacePre( double isoValue )
...
@@ -250,6 +251,25 @@ void WMMarchingCubes::generateSurfacePre( double isoValue )
}
}
void
WMMarchingCubes
::
transformPositions
(
ID2WPointXYZId
*
positions
)
{
wmath
::
WMatrix
<
double
>
mat
=
m_grid
->
getTransformationMatrix
();
for
(
ID2WPointXYZId
::
iterator
it
=
positions
->
begin
();
it
!=
positions
->
end
();
++
it
)
{
wmath
::
WPosition
pos
=
wmath
::
WPosition
(
it
->
second
.
x
,
it
->
second
.
y
,
it
->
second
.
z
);
std
::
vector
<
double
>
resultPos4D
(
4
);
resultPos4D
[
0
]
=
mat
(
0
,
0
)
*
pos
[
0
]
+
mat
(
0
,
1
)
*
pos
[
1
]
+
mat
(
0
,
2
)
*
pos
[
2
]
+
mat
(
0
,
3
)
*
1
;
resultPos4D
[
1
]
=
mat
(
1
,
0
)
*
pos
[
0
]
+
mat
(
1
,
1
)
*
pos
[
1
]
+
mat
(
1
,
2
)
*
pos
[
2
]
+
mat
(
1
,
3
)
*
1
;
resultPos4D
[
2
]
=
mat
(
2
,
0
)
*
pos
[
0
]
+
mat
(
2
,
1
)
*
pos
[
1
]
+
mat
(
2
,
2
)
*
pos
[
2
]
+
mat
(
2
,
3
)
*
1
;
resultPos4D
[
3
]
=
mat
(
3
,
0
)
*
pos
[
0
]
+
mat
(
3
,
1
)
*
pos
[
1
]
+
mat
(
3
,
2
)
*
pos
[
2
]
+
mat
(
3
,
3
)
*
1
;
it
->
second
.
x
=
resultPos4D
[
0
]
/
resultPos4D
[
3
];
it
->
second
.
y
=
resultPos4D
[
1
]
/
resultPos4D
[
3
];
it
->
second
.
z
=
resultPos4D
[
2
]
/
resultPos4D
[
3
];
}
}
template
<
typename
T
>
void
WMMarchingCubes
::
generateSurface
(
boost
::
shared_ptr
<
WGrid
>
inGrid
,
template
<
typename
T
>
void
WMMarchingCubes
::
generateSurface
(
boost
::
shared_ptr
<
WGrid
>
inGrid
,
boost
::
shared_ptr
<
WValueSet
<
T
>
>
vals
,
boost
::
shared_ptr
<
WValueSet
<
T
>
>
vals
,
double
isoValue
)
double
isoValue
)
...
@@ -415,6 +435,8 @@ template< typename T > void WMMarchingCubes::generateSurface( boost::shared_ptr<
...
@@ -415,6 +435,8 @@ template< typename T > void WMMarchingCubes::generateSurface( boost::shared_ptr<
}
}
}
}
}
}
transformPositions
(
&
m_idToVertices
);
progress
->
finish
();
progress
->
finish
();
}
}
...
...
src/modules/marchingCubes/WMMarchingCubes.h
View file @
2f74a229
...
@@ -135,6 +135,12 @@ public:
...
@@ -135,6 +135,12 @@ public:
*/
*/
virtual
const
char
**
getXPMIcon
()
const
;
virtual
const
char
**
getXPMIcon
()
const
;
/**
* Transform the positions to the correct coordiante system given by the grid.
* \param positions A data structure holding the positions.
*/
void
transformPositions
(
ID2WPointXYZId
*
positions
);
/**
/**
* Generate the triangles for the surface on the given dataSet (inGrid, vals).
* Generate the triangles for the surface on the given dataSet (inGrid, vals).
* \param inGrid The grid of the data set
* \param inGrid The grid of the data set
...
...
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