Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
OpenWalnut Core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
44
Issues
44
List
Boards
Labels
Service Desk
Milestones
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
3ead4f6a
Commit
3ead4f6a
authored
Oct 08, 2010
by
schurade
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ADD] a switch to use marching lego in the marching cubes module
parent
f18b259c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
25 deletions
+82
-25
src/modules/marchingCubes/WMMarchingCubes.cpp
src/modules/marchingCubes/WMMarchingCubes.cpp
+80
-25
src/modules/marchingCubes/WMMarchingCubes.h
src/modules/marchingCubes/WMMarchingCubes.h
+2
-0
No files found.
src/modules/marchingCubes/WMMarchingCubes.cpp
View file @
3ead4f6a
...
@@ -55,6 +55,7 @@
...
@@ -55,6 +55,7 @@
#include "../../kernel/WKernel.h"
#include "../../kernel/WKernel.h"
#include "../../graphicsEngine/algorithms/WMarchingCubesAlgorithm.h"
#include "../../graphicsEngine/algorithms/WMarchingCubesAlgorithm.h"
#include "../../graphicsEngine/algorithms/WMarchingLegoAlgorithm.h"
#include "WMMarchingCubes.h"
#include "WMMarchingCubes.h"
// This line is needed by the module loader to actually find your module.
// This line is needed by the module loader to actually find your module.
...
@@ -223,6 +224,8 @@ void WMMarchingCubes::properties()
...
@@ -223,6 +224,8 @@ void WMMarchingCubes::properties()
m_surfaceColor
=
m_properties
->
addProperty
(
"Surface color"
,
"Description."
,
WColor
(
0.5
,
0.5
,
0.5
,
1.0
)
);
m_surfaceColor
=
m_properties
->
addProperty
(
"Surface color"
,
"Description."
,
WColor
(
0.5
,
0.5
,
0.5
,
1.0
)
);
m_useMarchingLego
=
m_properties
->
addProperty
(
"voxel surface"
,
"Not interpolated surface"
,
false
,
m_recompute
);
WModule
::
properties
();
WModule
::
properties
();
}
}
...
@@ -232,6 +235,7 @@ void WMMarchingCubes::generateSurfacePre( double isoValue )
...
@@ -232,6 +235,7 @@ void WMMarchingCubes::generateSurfacePre( double isoValue )
WAssert
(
(
*
m_dataSet
).
getValueSet
()
->
order
()
==
0
,
"This module only works on scalars."
);
WAssert
(
(
*
m_dataSet
).
getValueSet
()
->
order
()
==
0
,
"This module only works on scalars."
);
WMarchingCubesAlgorithm
mcAlgo
;
WMarchingCubesAlgorithm
mcAlgo
;
WMarchingLegoAlgorithm
mlAlgo
;
boost
::
shared_ptr
<
WGridRegular3D
>
gridRegular3D
=
boost
::
shared_dynamic_cast
<
WGridRegular3D
>
(
(
*
m_dataSet
).
getGrid
()
);
boost
::
shared_ptr
<
WGridRegular3D
>
gridRegular3D
=
boost
::
shared_dynamic_cast
<
WGridRegular3D
>
(
(
*
m_dataSet
).
getGrid
()
);
WAssert
(
gridRegular3D
,
"Grid is not of type WGridRegular3D."
);
WAssert
(
gridRegular3D
,
"Grid is not of type WGridRegular3D."
);
m_grid
=
gridRegular3D
;
m_grid
=
gridRegular3D
;
...
@@ -243,11 +247,22 @@ void WMMarchingCubes::generateSurfacePre( double isoValue )
...
@@ -243,11 +247,22 @@ void WMMarchingCubes::generateSurfacePre( double isoValue )
boost
::
shared_ptr
<
WValueSet
<
unsigned
char
>
>
vals
;
boost
::
shared_ptr
<
WValueSet
<
unsigned
char
>
>
vals
;
vals
=
boost
::
shared_dynamic_cast
<
WValueSet
<
unsigned
char
>
>
(
(
*
m_dataSet
).
getValueSet
()
);
vals
=
boost
::
shared_dynamic_cast
<
WValueSet
<
unsigned
char
>
>
(
(
*
m_dataSet
).
getValueSet
()
);
WAssert
(
vals
,
"Data type and data type indicator must fit."
);
WAssert
(
vals
,
"Data type and data type indicator must fit."
);
m_triMesh
=
mcAlgo
.
generateSurface
(
m_grid
->
getNbCoordsX
(),
m_grid
->
getNbCoordsY
(),
m_grid
->
getNbCoordsZ
(),
m_grid
->
getTransformationMatrix
(),
if
(
m_useMarchingLego
->
get
()
)
vals
->
rawDataVectorPointer
(),
{
isoValue
,
m_triMesh
=
mlAlgo
.
generateSurface
(
m_grid
->
getNbCoordsX
(),
m_grid
->
getNbCoordsY
(),
m_grid
->
getNbCoordsZ
(),
m_progress
);
m_grid
->
getTransformationMatrix
(),
vals
->
rawDataVectorPointer
(),
isoValue
);
}
else
{
m_triMesh
=
mcAlgo
.
generateSurface
(
m_grid
->
getNbCoordsX
(),
m_grid
->
getNbCoordsY
(),
m_grid
->
getNbCoordsZ
(),
m_grid
->
getTransformationMatrix
(),
vals
->
rawDataVectorPointer
(),
isoValue
,
m_progress
);
}
break
;
break
;
}
}
case
W_DT_INT16
:
case
W_DT_INT16
:
...
@@ -255,11 +270,21 @@ void WMMarchingCubes::generateSurfacePre( double isoValue )
...
@@ -255,11 +270,21 @@ void WMMarchingCubes::generateSurfacePre( double isoValue )
boost
::
shared_ptr
<
WValueSet
<
int16_t
>
>
vals
;
boost
::
shared_ptr
<
WValueSet
<
int16_t
>
>
vals
;
vals
=
boost
::
shared_dynamic_cast
<
WValueSet
<
int16_t
>
>
(
(
*
m_dataSet
).
getValueSet
()
);
vals
=
boost
::
shared_dynamic_cast
<
WValueSet
<
int16_t
>
>
(
(
*
m_dataSet
).
getValueSet
()
);
WAssert
(
vals
,
"Data type and data type indicator must fit."
);
WAssert
(
vals
,
"Data type and data type indicator must fit."
);
m_triMesh
=
mcAlgo
.
generateSurface
(
m_grid
->
getNbCoordsX
(),
m_grid
->
getNbCoordsY
(),
m_grid
->
getNbCoordsZ
(),
if
(
m_useMarchingLego
->
get
()
)
m_grid
->
getTransformationMatrix
(),
{
vals
->
rawDataVectorPointer
(),
m_triMesh
=
mlAlgo
.
generateSurface
(
m_grid
->
getNbCoordsX
(),
m_grid
->
getNbCoordsY
(),
m_grid
->
getNbCoordsZ
(),
isoValue
,
m_grid
->
getTransformationMatrix
(),
m_progress
);
vals
->
rawDataVectorPointer
(),
isoValue
);
}
else
{
m_triMesh
=
mcAlgo
.
generateSurface
(
m_grid
->
getNbCoordsX
(),
m_grid
->
getNbCoordsY
(),
m_grid
->
getNbCoordsZ
(),
m_grid
->
getTransformationMatrix
(),
vals
->
rawDataVectorPointer
(),
isoValue
,
m_progress
);
}
break
;
break
;
}
}
case
W_DT_SIGNED_INT
:
case
W_DT_SIGNED_INT
:
...
@@ -267,11 +292,21 @@ void WMMarchingCubes::generateSurfacePre( double isoValue )
...
@@ -267,11 +292,21 @@ void WMMarchingCubes::generateSurfacePre( double isoValue )
boost
::
shared_ptr
<
WValueSet
<
int32_t
>
>
vals
;
boost
::
shared_ptr
<
WValueSet
<
int32_t
>
>
vals
;
vals
=
boost
::
shared_dynamic_cast
<
WValueSet
<
int32_t
>
>
(
(
*
m_dataSet
).
getValueSet
()
);
vals
=
boost
::
shared_dynamic_cast
<
WValueSet
<
int32_t
>
>
(
(
*
m_dataSet
).
getValueSet
()
);
WAssert
(
vals
,
"Data type and data type indicator must fit."
);
WAssert
(
vals
,
"Data type and data type indicator must fit."
);
m_triMesh
=
mcAlgo
.
generateSurface
(
m_grid
->
getNbCoordsX
(),
m_grid
->
getNbCoordsY
(),
m_grid
->
getNbCoordsZ
(),
if
(
m_useMarchingLego
->
get
()
)
m_grid
->
getTransformationMatrix
(),
{
vals
->
rawDataVectorPointer
(),
m_triMesh
=
mlAlgo
.
generateSurface
(
m_grid
->
getNbCoordsX
(),
m_grid
->
getNbCoordsY
(),
m_grid
->
getNbCoordsZ
(),
isoValue
,
m_grid
->
getTransformationMatrix
(),
m_progress
);
vals
->
rawDataVectorPointer
(),
isoValue
);
}
else
{
m_triMesh
=
mcAlgo
.
generateSurface
(
m_grid
->
getNbCoordsX
(),
m_grid
->
getNbCoordsY
(),
m_grid
->
getNbCoordsZ
(),
m_grid
->
getTransformationMatrix
(),
vals
->
rawDataVectorPointer
(),
isoValue
,
m_progress
);
}
break
;
break
;
}
}
case
W_DT_FLOAT
:
case
W_DT_FLOAT
:
...
@@ -279,11 +314,21 @@ void WMMarchingCubes::generateSurfacePre( double isoValue )
...
@@ -279,11 +314,21 @@ void WMMarchingCubes::generateSurfacePre( double isoValue )
boost
::
shared_ptr
<
WValueSet
<
float
>
>
vals
;
boost
::
shared_ptr
<
WValueSet
<
float
>
>
vals
;
vals
=
boost
::
shared_dynamic_cast
<
WValueSet
<
float
>
>
(
(
*
m_dataSet
).
getValueSet
()
);
vals
=
boost
::
shared_dynamic_cast
<
WValueSet
<
float
>
>
(
(
*
m_dataSet
).
getValueSet
()
);
WAssert
(
vals
,
"Data type and data type indicator must fit."
);
WAssert
(
vals
,
"Data type and data type indicator must fit."
);
m_triMesh
=
mcAlgo
.
generateSurface
(
m_grid
->
getNbCoordsX
(),
m_grid
->
getNbCoordsY
(),
m_grid
->
getNbCoordsZ
(),
if
(
m_useMarchingLego
->
get
()
)
m_grid
->
getTransformationMatrix
(),
{
vals
->
rawDataVectorPointer
(),
m_triMesh
=
mlAlgo
.
generateSurface
(
m_grid
->
getNbCoordsX
(),
m_grid
->
getNbCoordsY
(),
m_grid
->
getNbCoordsZ
(),
isoValue
,
m_grid
->
getTransformationMatrix
(),
m_progress
);
vals
->
rawDataVectorPointer
(),
isoValue
);
}
else
{
m_triMesh
=
mcAlgo
.
generateSurface
(
m_grid
->
getNbCoordsX
(),
m_grid
->
getNbCoordsY
(),
m_grid
->
getNbCoordsZ
(),
m_grid
->
getTransformationMatrix
(),
vals
->
rawDataVectorPointer
(),
isoValue
,
m_progress
);
}
break
;
break
;
}
}
case
W_DT_DOUBLE
:
case
W_DT_DOUBLE
:
...
@@ -291,11 +336,21 @@ void WMMarchingCubes::generateSurfacePre( double isoValue )
...
@@ -291,11 +336,21 @@ void WMMarchingCubes::generateSurfacePre( double isoValue )
boost
::
shared_ptr
<
WValueSet
<
double
>
>
vals
;
boost
::
shared_ptr
<
WValueSet
<
double
>
>
vals
;
vals
=
boost
::
shared_dynamic_cast
<
WValueSet
<
double
>
>
(
(
*
m_dataSet
).
getValueSet
()
);
vals
=
boost
::
shared_dynamic_cast
<
WValueSet
<
double
>
>
(
(
*
m_dataSet
).
getValueSet
()
);
WAssert
(
vals
,
"Data type and data type indicator must fit."
);
WAssert
(
vals
,
"Data type and data type indicator must fit."
);
m_triMesh
=
mcAlgo
.
generateSurface
(
m_grid
->
getNbCoordsX
(),
m_grid
->
getNbCoordsY
(),
m_grid
->
getNbCoordsZ
(),
if
(
m_useMarchingLego
->
get
()
)
m_grid
->
getTransformationMatrix
(),
{
vals
->
rawDataVectorPointer
(),
m_triMesh
=
mlAlgo
.
generateSurface
(
m_grid
->
getNbCoordsX
(),
m_grid
->
getNbCoordsY
(),
m_grid
->
getNbCoordsZ
(),
isoValue
,
m_grid
->
getTransformationMatrix
(),
m_progress
);
vals
->
rawDataVectorPointer
(),
isoValue
);
}
else
{
m_triMesh
=
mcAlgo
.
generateSurface
(
m_grid
->
getNbCoordsX
(),
m_grid
->
getNbCoordsY
(),
m_grid
->
getNbCoordsZ
(),
m_grid
->
getTransformationMatrix
(),
vals
->
rawDataVectorPointer
(),
isoValue
,
m_progress
);
}
break
;
break
;
}
}
default:
default:
...
...
src/modules/marchingCubes/WMMarchingCubes.h
View file @
3ead4f6a
...
@@ -140,6 +140,8 @@ private:
...
@@ -140,6 +140,8 @@ private:
WPropBool
m_useTextureProp
;
//!< Property indicating whether to use texturing with scalar data sets.
WPropBool
m_useTextureProp
;
//!< Property indicating whether to use texturing with scalar data sets.
WPropColor
m_surfaceColor
;
//!< Property determining the color for the surface if no textures are displayed
WPropColor
m_surfaceColor
;
//!< Property determining the color for the surface if no textures are displayed
WPropBool
m_useMarchingLego
;
//!< Property indicating whether to use interpolated or non interpolated triangulation
/**
/**
* True when textures haven changed.
* True when textures haven changed.
*/
*/
...
...
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