Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ViSTA
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LuFG VR VIS
VR-Group
ViSTA
Commits
2c72c67f
Commit
2c72c67f
authored
9 years ago
by
Simon Schneegans
Browse files
Options
Downloads
Plain Diff
Merge branch 'develop' into feature/SensorMappingFix
parents
a879c0e8
73ff8350
No related branches found
No related tags found
1 merge request
!16
Sensor mapping fix
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
VistaCoreLibs/VistaBase/VistaMathBasics.h
+14
-1
14 additions, 1 deletion
VistaCoreLibs/VistaBase/VistaMathBasics.h
with
14 additions
and
1 deletion
VistaCoreLibs/VistaBase/VistaMathBasics.h
+
14
−
1
View file @
2c72c67f
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
/* INCLUDES */
/* INCLUDES */
/*============================================================================*/
/*============================================================================*/
#include
<cassert>
#include
<cmath>
#include
<cmath>
#include
<limits>
#include
<limits>
...
@@ -68,9 +69,14 @@ namespace Vista
...
@@ -68,9 +69,14 @@ namespace Vista
template
<
typename
TFloat
>
template
<
typename
TFloat
>
bool
IsValidNumber
(
const
TFloat
fValue
);
bool
IsValidNumber
(
const
TFloat
fValue
);
// clamps val to the range [minVal, maxVal]
template
<
typename
TFloat
>
template
<
typename
TFloat
>
TFloat
Clamp
(
const
TFloat
val
,
const
TFloat
minVal
,
const
TFloat
maxVal
);
TFloat
Clamp
(
const
TFloat
val
,
const
TFloat
minVal
,
const
TFloat
maxVal
);
// mixes valA and valB using a param in [0, 1]
template
<
typename
TFloat
,
typename
TParam
>
TFloat
Mix
(
const
TParam
param
,
const
TFloat
valA
,
const
TFloat
valB
);
// true iff val >= minVal && val <= maxVal
// true iff val >= minVal && val <= maxVal
template
<
typename
TFloat
>
template
<
typename
TFloat
>
bool
GetIsInRangeInclusive
(
const
TFloat
val
,
const
TFloat
minVal
,
const
TFloat
maxVal
);
bool
GetIsInRangeInclusive
(
const
TFloat
val
,
const
TFloat
minVal
,
const
TFloat
maxVal
);
...
@@ -82,7 +88,7 @@ namespace Vista
...
@@ -82,7 +88,7 @@ namespace Vista
template
<
typename
TFloat
>
template
<
typename
TFloat
>
TFloat
Sign
(
const
TFloat
val
);
TFloat
Sign
(
const
TFloat
val
);
}
}
// namespace Vista
/**
/**
* Convert angles given in radians to degrees and vice versa.
* Convert angles given in radians to degrees and vice versa.
...
@@ -122,6 +128,13 @@ TFloat Vista::Clamp( const TFloat val, const TFloat minVal, const TFloat maxVal
...
@@ -122,6 +128,13 @@ TFloat Vista::Clamp( const TFloat val, const TFloat minVal, const TFloat maxVal
return
val
<
minVal
?
minVal
:
(
val
>
maxVal
?
maxVal
:
val
);
return
val
<
minVal
?
minVal
:
(
val
>
maxVal
?
maxVal
:
val
);
}
}
template
<
typename
TFloat
,
typename
TParam
>
TFloat
Vista
::
Mix
(
const
TParam
param
,
const
TFloat
valA
,
const
TFloat
valB
)
{
assert
(
param
>=
TParam
(
0.0
)
&&
param
<=
TParam
(
1.0
)
&&
"Invalid mix param."
);
return
(
TParam
(
1.0
)
-
param
)
*
valA
+
param
*
valB
;
}
template
<
typename
TFloat
>
template
<
typename
TFloat
>
bool
Vista
::
GetIsInRangeInclusive
(
const
TFloat
val
,
const
TFloat
minVal
,
const
TFloat
maxVal
)
bool
Vista
::
GetIsInRangeInclusive
(
const
TFloat
val
,
const
TFloat
minVal
,
const
TFloat
maxVal
)
{
{
...
...
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