Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Simox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Florian Leander Singer
Simox
Commits
2ae1912b
Commit
2ae1912b
authored
5 years ago
by
Rainer Kartmann
Browse files
Options
Downloads
Patches
Plain Diff
Add overloads of set_vmin/max/limits() for std::vector<float>
(not necessary for demo)
parent
d67a4fb5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
SimoxUtility/color/ColorMap.h
+11
-1
11 additions, 1 deletion
SimoxUtility/color/ColorMap.h
with
11 additions
and
1 deletion
SimoxUtility/color/ColorMap.h
+
11
−
1
View file @
2ae1912b
#pragma once
#include
<algorithm>
#include
<initializer_list>
#include
<map>
#include
<string>
...
...
@@ -70,10 +71,13 @@ namespace simox::color
/// The value corresponding to the bottom color.
float
vmin
()
const
{
return
_vmin
?
*
_vmin
:
original_vmin
();
}
void
set_vmin
(
float
vmin
)
{
this
->
_vmin
=
vmin
;
}
/// The value corresponding to the top color.
float
vmax
()
const
{
return
_vmax
?
*
_vmax
:
original_vmax
();
}
void
set_vmin
(
float
vmin
)
{
this
->
_vmin
=
vmin
;
}
void
set_vmax
(
float
vmax
)
{
this
->
_vmax
=
vmax
;
}
void
set_vmin
(
const
std
::
vector
<
float
>&
values
)
{
set_vmin
(
*
std
::
max_element
(
values
.
begin
(),
values
.
end
()));
}
void
set_vmax
(
const
std
::
vector
<
float
>&
values
)
{
set_vmax
(
*
std
::
max_element
(
values
.
begin
(),
values
.
end
()));
}
/// Sets the value limits, i.e. scales the color map to the range [vmin, vmax].
void
set_vlimits
(
float
vmin
,
float
vmax
)
...
...
@@ -81,6 +85,12 @@ namespace simox::color
set_vmin
(
vmin
);
set_vmax
(
vmax
);
}
void
set_vlimits
(
const
std
::
vector
<
float
>&
values
)
{
const
auto
[
min
,
max
]
=
std
::
minmax_element
(
values
.
begin
(),
values
.
end
());
set_vmin
(
*
min
);
set_vmax
(
*
max
);
}
/// Get this colormap reversed (but defined in the same value range as this).
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment