Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenFlipper-Free
Plugin-PropertyVis
Commits
ceb6e7fe
Commit
ceb6e7fe
authored
Feb 05, 2020
by
Martin Heistermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ovm-double propvis: simplify logic
parent
0a494df6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
35 deletions
+25
-35
OpenVolumeMesh/OVMPropertyVisualizerDoubleT_impl.hh
OpenVolumeMesh/OVMPropertyVisualizerDoubleT_impl.hh
+25
-35
No files found.
OpenVolumeMesh/OVMPropertyVisualizerDoubleT_impl.hh
View file @
ceb6e7fe
...
...
@@ -73,31 +73,24 @@ void OVMPropertyVisualizerDouble<MeshT>::visualizeProp(PropType prop, HandleIter
if
(
!
prop
)
return
;
DoubleWidget
*
doubleWidget
=
static_cast
<
DoubleWidget
*>
(
PropertyVisualizer
::
widget
);
ACG
::
Vec4f
colorMin
=
ACG
::
to_Vec4f
(
doubleWidget
->
doubleMin
->
color
());
auto
cc
=
doubleWidget
->
buildColorCoder
();
double
min
,
max
;
if
(
doubleWidget
->
doubleAbsolute
->
isChecked
()
){
min
=
FLT_MAX
;
max
=
0.0
;
}
else
{
min
=
FLT_MAX
;
max
=
FLT_MIN
;
}
for
(
const
Handle
&
h
:
handles
)
{
double
value
=
prop
[
h
];
if
(
doubleWidget
->
doubleAbsolute
->
isChecked
()
){
min
=
std
::
min
(
min
,
fabs
(
value
));
max
=
std
::
max
(
max
,
fabs
(
value
));
bool
abs
=
doubleWidget
->
doubleAbsolute
->
isChecked
();
auto
transform_value
=
[
abs
](
double
v
)
{
if
(
abs
)
{
return
std
::
fabs
(
v
);
}
else
{
min
=
std
::
min
(
min
,
value
);
max
=
std
::
max
(
max
,
value
);
}
}
return
v
;
};
};
auto
get_value
=
[
&
](
Handle
handle
)
{
return
transform_value
(
prop
[
handle
]);
};
// fixed range?
double
min
,
max
;
if
(
doubleWidget
->
doubleFixedRange
->
isChecked
())
{
min
=
doubleWidget
->
doubleFixedRangeMin
->
value
();
...
...
@@ -105,6 +98,13 @@ void OVMPropertyVisualizerDouble<MeshT>::visualizeProp(PropType prop, HandleIter
}
else
{
min
=
std
::
numeric_limits
<
double
>::
infinity
();
max
=
-
std
::
numeric_limits
<
double
>::
infinity
();
for
(
const
Handle
&
h
:
handles
)
{
auto
value
=
get_value
(
h
);
min
=
std
::
min
(
min
,
value
);
max
=
std
::
max
(
max
,
value
);
}
doubleWidget
->
doubleFixedRangeMin
->
setValue
(
min
);
doubleWidget
->
doubleFixedRangeMax
->
setValue
(
max
);
}
...
...
@@ -113,21 +113,11 @@ void OVMPropertyVisualizerDouble<MeshT>::visualizeProp(PropType prop, HandleIter
VolumeMeshObject
<
MeshT
>*
object
;
PluginFunctions
::
getObject
(
OVMPropertyVisualizer
<
MeshT
>::
mObjectID
,
object
);
for
(
const
Handle
&
h
:
handles
)
{
if
(
range
==
0.0
)
object
->
colors
()[
h
]
=
colorMin
;
else
{
double
value
=
prop
[
h
];
// absolut value?
if
(
doubleWidget
->
doubleAbsolute
->
isChecked
())
value
=
fabs
(
value
);
double
t
=
(
value
-
min
)
/
range
;
object
->
colors
()[
h
]
=
cc
->
color_float4
(
t
);
}
for
(
const
Handle
&
h
:
handles
)
{
double
value
=
get_value
(
h
);
double
t
=
(
value
-
min
)
/
range
;
object
->
colors
()[
h
]
=
cc
->
color_float4
(
t
);
}
}
CALLS_TO_VISUALIZE_PROP
(
OVMPropertyVisualizerDouble
<
MeshT
>
,
typename
MeshT
,
double
)
...
...
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