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
974d8511
Commit
974d8511
authored
Nov 22, 2009
by
Alexander Wiebel
Browse files
[ADD
#119
] adapted marchingCubes interface for use in other modules
parent
2ca0e93b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
24 deletions
+28
-24
src/modules/marchingCubes/WMMarchingCubes.cpp
src/modules/marchingCubes/WMMarchingCubes.cpp
+19
-16
src/modules/marchingCubes/WMMarchingCubes.h
src/modules/marchingCubes/WMMarchingCubes.h
+9
-8
No files found.
src/modules/marchingCubes/WMMarchingCubes.cpp
View file @
974d8511
...
...
@@ -107,25 +107,13 @@ void WMMarchingCubes::moduleMain()
boost
::
shared_ptr
<
WDataHandler
>
dh
=
WKernel
::
getRunningKernel
()
->
getDataHandler
();
boost
::
shared_ptr
<
WSubject
>
subject
=
(
*
dh
)[
0
];
m_dataSet
=
boost
::
shared_dynamic_cast
<
const
WDataSetSingle
>
(
(
*
subject
)[
0
]
);
boost
::
shared_ptr
<
WGridRegular3D
>
grid
=
boost
::
shared_dynamic_cast
<
WGridRegular3D
>
(
m_dataSet
->
getGrid
()
);
assert
(
grid
);
m_vals
=
boost
::
shared_dynamic_cast
<
WValueSet
<
unsigned
char
>
>
(
m_dataSet
->
getValueSet
()
);
assert
(
m_vals
);
m_fCellLengthX
=
grid
->
getOffsetX
();
m_fCellLengthY
=
grid
->
getOffsetY
();
m_fCellLengthZ
=
grid
->
getOffsetZ
();
m_nCellsX
=
grid
->
getNbCoordsX
()
-
1
;
m_nCellsY
=
grid
->
getNbCoordsY
()
-
1
;
m_nCellsZ
=
grid
->
getNbCoordsZ
()
-
1
;
boost
::
shared_ptr
<
const
WDataSetSingle
>
dataSet
;
dataSet
=
boost
::
shared_dynamic_cast
<
const
WDataSetSingle
>
(
(
*
subject
)[
0
]
);
WLogger
::
getLogger
()
->
addLogMessage
(
"Computing surface ..."
,
"Marching Cubes"
,
LL_DEBUG
);
// TODO(wiebel): MC set correct isoValue here
generateSurface
(
110
);
generateSurface
(
dataSet
,
110
);
// TODO(wiebel): MC remove this from here
// renderMesh( load( "/tmp/isosurfaceTestMesh.vtk" ) );
...
...
@@ -170,8 +158,23 @@ void WMMarchingCubes::slotPropertyChanged( std::string propertyName )
assert
(
0
&&
"This property name is not soppurted by this function yet."
);
}
}
void
WMMarchingCubes
::
generateSurface
(
double
isoValue
)
void
WMMarchingCubes
::
generateSurface
(
const
boost
::
shared_ptr
<
const
WDataSetSingle
>
dataSet
,
double
isoValue
)
{
m_dataSet
=
dataSet
;
boost
::
shared_ptr
<
WGridRegular3D
>
grid
=
boost
::
shared_dynamic_cast
<
WGridRegular3D
>
(
m_dataSet
->
getGrid
()
);
assert
(
grid
);
m_vals
=
boost
::
shared_dynamic_cast
<
WValueSet
<
unsigned
char
>
>
(
m_dataSet
->
getValueSet
()
);
assert
(
m_vals
);
m_fCellLengthX
=
grid
->
getOffsetX
();
m_fCellLengthY
=
grid
->
getOffsetY
();
m_fCellLengthZ
=
grid
->
getOffsetZ
();
m_nCellsX
=
grid
->
getNbCoordsX
()
-
1
;
m_nCellsY
=
grid
->
getNbCoordsY
()
-
1
;
m_nCellsZ
=
grid
->
getNbCoordsZ
()
-
1
;
m_tIsoLevel
=
isoValue
;
unsigned
int
nX
=
m_nCellsX
+
1
;
...
...
src/modules/marchingCubes/WMMarchingCubes.h
View file @
974d8511
...
...
@@ -113,11 +113,19 @@ public:
/**
* Due to the prototype design pattern used to build modules, this method returns a new instance of this method. NOTE: it
* should never be initialized or modified in some other way. A simple new instance is required.
*
*
* \return the prototype used to create every module in OpenWalnut.
*/
virtual
boost
::
shared_ptr
<
WModule
>
factory
()
const
;
/**
* Generate the triangles for the surface
*/
void
generateSurface
(
const
boost
::
shared_ptr
<
const
WDataSetSingle
>
dataSet
,
double
isoValue
);
// TODO(wiebel): MC document this;
void
renderSurface
();
protected:
/**
* Entry point after loading the module. Runs in separate thread.
...
...
@@ -143,11 +151,6 @@ private:
boost
::
shared_ptr
<
const
WDataSetSingle
>
m_dataSet
;
//!< Convenience pointer to the data set we are dealing with
boost
::
shared_ptr
<
WValueSet
<
unsigned
char
>
>
m_vals
;
//!< Convenience pointer to the values set we are dealing with
/**
* Generate the triangles for the surface
*/
void
generateSurface
(
double
isoValue
);
/**
* Calculates the intersection point of the isosurface with an
* edge.
...
...
@@ -183,8 +186,6 @@ private:
ID2WPointXYZId
m_idToVertices
;
//!< List of WPointXYZIds which form the isosurface.
WMCTriangleVECTOR
m_trivecTriangles
;
//!< List of WMCTriangleS which form the triangulation of the isosurface.
// TODO(wiebel): MC document this;
void
renderSurface
();
// TODO(wiebel): MC document this;
void
renderMesh
(
WTriangleMesh
*
mesh
);
...
...
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