Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CAMP
campvis-public
Commits
0868b161
Commit
0868b161
authored
Jan 29, 2014
by
Christian Schulte zu Berge
Browse files
Added a couple of demo color maps to TFGeometry1D.
parent
cba0fd9b
Changes
2
Hide whitespace changes
Inline
Side-by-side
core/classification/tfgeometry1d.cpp
View file @
0868b161
...
...
@@ -97,7 +97,8 @@ namespace campvis {
FaceGeometry
fg
(
vertices
,
std
::
vector
<
tgt
::
vec3
>
(),
colors
);
fg
.
render
(
GL_TRIANGLE_STRIP
);
}
TFGeometry1D
*
TFGeometry1D
::
createQuad
(
const
tgt
::
vec2
&
interval
,
const
tgt
::
col4
&
leftColor
,
const
tgt
::
vec4
&
rightColor
)
{
TFGeometry1D
*
TFGeometry1D
::
createQuad
(
const
tgt
::
vec2
&
interval
,
const
tgt
::
col4
&
leftColor
,
const
tgt
::
col4
&
rightColor
)
{
tgtAssert
(
interval
.
x
>=
0.
f
&&
interval
.
y
<=
1.
f
,
"Interval out of bounds"
);
std
::
vector
<
KeyPoint
>
keyPoints
;
...
...
@@ -107,4 +108,30 @@ namespace campvis {
}
TFGeometry1D
*
TFGeometry1D
::
createDivergingColorMap
(
const
tgt
::
vec2
&
interval
,
const
tgt
::
col4
&
leftColor
,
const
tgt
::
col4
&
rightColor
,
float
bias
/*= 0.5f*/
)
{
tgtAssert
(
interval
.
x
>=
0.
f
&&
interval
.
y
<=
1.
f
,
"Interval out of bounds, must be in [0, 1]."
);
tgtAssert
(
bias
>
0.
f
&&
bias
<
1.
f
,
"Bias out of bounds, must be in (0, 1)."
);
std
::
vector
<
KeyPoint
>
keyPoints
;
keyPoints
.
push_back
(
KeyPoint
(
interval
.
x
,
leftColor
));
keyPoints
.
push_back
(
KeyPoint
(
interval
.
x
+
(
interval
.
y
-
interval
.
x
)
*
bias
,
tgt
::
col4
(
255
,
255
,
255
,
255
)));
keyPoints
.
push_back
(
KeyPoint
(
interval
.
y
,
rightColor
));
return
new
TFGeometry1D
(
keyPoints
);
}
TFGeometry1D
*
TFGeometry1D
::
createColdHotColorMap
(
const
tgt
::
vec2
&
interval
/*= tgt::vec2(0.f, 1.f)*/
)
{
return
createDivergingColorMap
(
interval
,
tgt
::
col4
(
0
,
0
,
255
,
255
),
tgt
::
col4
(
255
,
0
,
0
,
255
),
0.5
f
);
}
TFGeometry1D
*
TFGeometry1D
::
createHeatedBodyColorMap
(
const
tgt
::
vec2
&
interval
/*= tgt::vec2(0.f, 1.f)*/
)
{
tgtAssert
(
interval
.
x
>=
0.
f
&&
interval
.
y
<=
1.
f
,
"Interval out of bounds, must be in [0, 1]."
);
std
::
vector
<
KeyPoint
>
keyPoints
;
keyPoints
.
push_back
(
KeyPoint
(
interval
.
x
,
tgt
::
col4
(
0
,
0
,
0
,
255
)));
keyPoints
.
push_back
(
KeyPoint
(
interval
.
x
+
(
interval
.
y
-
interval
.
x
)
*
0.35
f
,
tgt
::
col4
(
224
,
0
,
0
,
255
)));
keyPoints
.
push_back
(
KeyPoint
(
interval
.
x
+
(
interval
.
y
-
interval
.
x
)
*
0.85
f
,
tgt
::
col4
(
255
,
255
,
0
,
255
)));
keyPoints
.
push_back
(
KeyPoint
(
interval
.
y
,
tgt
::
col4
(
255
,
255
,
255
,
255
)));
return
new
TFGeometry1D
(
keyPoints
);
}
}
\ No newline at end of file
core/classification/tfgeometry1d.h
View file @
0868b161
...
...
@@ -97,12 +97,36 @@ namespace campvis {
/**
* Creates a simple quad geometry for the given interval.
* A quad geometry consists of two KeyPoints.
* \param interval Interval the geometry resides in
* \param interval Interval the geometry resides in
, must be in [0, 1].
* \param leftColor Color for left KeyPoint
* \param rightColor Color for right KeyPoint
* \return A TFGeometry1D modelling a quad with two KeyPoints.
*/
static
TFGeometry1D
*
createQuad
(
const
tgt
::
vec2
&
interval
,
const
tgt
::
col4
&
leftColor
,
const
tgt
::
vec4
&
rightColor
);
static
TFGeometry1D
*
createQuad
(
const
tgt
::
vec2
&
interval
,
const
tgt
::
col4
&
leftColor
,
const
tgt
::
col4
&
rightColor
);
/**
* Creates a diverging color map of two diverging colors blending over white.
* \param interval Interval the geometry resides in, must be in [0, 1].
* \param leftColor Color for left diverging color.
* \param rightColor Color for right diverging color
* \return A TFGeometry1D modelling a diverging color map with three key points.
*/
static
TFGeometry1D
*
createDivergingColorMap
(
const
tgt
::
vec2
&
interval
,
const
tgt
::
col4
&
leftColor
,
const
tgt
::
col4
&
rightColor
,
float
bias
=
0.5
f
);
/**
* Creates the cold-hot color map blending blue to red via white.
* \param interval Intensity domain for color map, must be in [0, 1].
* \return A TFGeometry1D building the cold-hot color map for the given interval.
*/
static
TFGeometry1D
*
createColdHotColorMap
(
const
tgt
::
vec2
&
interval
=
tgt
::
vec2
(
0.
f
,
1.
f
));
/**
* Creates the heated body color map blending black-red-yellow-white.
* \param interval Intensity domain for color map, must be in [0, 1].
* \return A TFGeometry1D building the heated body color map for the given interval.
*/
static
TFGeometry1D
*
createHeatedBodyColorMap
(
const
tgt
::
vec2
&
interval
=
tgt
::
vec2
(
0.
f
,
1.
f
));
protected:
std
::
vector
<
KeyPoint
>
_keyPoints
;
///< vector of KeyPoints, KeyPoints are sorted by x-coordinate of the position
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment