Image Component Library (ICL)
ICLMath
src
ICLMath
LinearTransform1D.h
Go to the documentation of this file.
1
/********************************************************************
2
** Image Component Library (ICL) **
3
** **
4
** Copyright (C) 2006-2013 CITEC, University of Bielefeld **
5
** Neuroinformatics Group **
6
** Website: www.iclcv.org and **
7
** http://opensource.cit-ec.de/projects/icl **
8
** **
9
** File : ICLMath/src/ICLMath/LinearTransform1D.h **
10
** Module : ICLMath **
11
** Authors: Christof Elbrechter **
12
** **
13
** **
14
** GNU LESSER GENERAL PUBLIC LICENSE **
15
** This file may be used under the terms of the GNU Lesser General **
16
** Public License version 3.0 as published by the **
17
** **
18
** Free Software Foundation and appearing in the file LICENSE.LGPL **
19
** included in the packaging of this file. Please review the **
20
** following information to ensure the license requirements will **
21
** be met: http://www.gnu.org/licenses/lgpl-3.0.txt **
22
** **
23
** The development of this software was supported by the **
24
** Excellence Cluster EXC 277 Cognitive Interaction Technology. **
25
** The Excellence Cluster EXC 277 is a grant of the Deutsche **
26
** Forschungsgemeinschaft (DFG) in the context of the German **
27
** Excellence Initiative. **
28
** **
29
********************************************************************/
30
31
#pragma once
32
33
#include <
ICLUtils/CompatMacros.h
>
34
#include <
ICLUtils/Range.h
>
35
36
namespace
icl
{
37
namespace
math{
38
40
struct
LinearTransform1D
{
42
float
m
;
43
45
float
b
;
46
48
inline
LinearTransform1D
(
float
m
=0,
float
b
=0):
m
(
m
),
b
(
b
){}
49
51
template
<
class
T>
52
inline
LinearTransform1D
(
const
utils::Range<T>
&s,
const
utils::Range<T>
&d):
53
m
(d.getLength()/s.getLength()),
b
(-
m
*s.minVal + d.minVal){
54
}
55
57
float
operator()
(
float
x)
const
{
return
m
*x+
b
; }
58
};
59
60
}
// namespace math
61
}
62
icl::math::LinearTransform1D::b
float b
offset
Definition:
LinearTransform1D.h:45
icl::utils::Range
class representing a range defined by min and max value
Definition:
Range.h:49
icl
undocument this line if you encounter any issues!
Definition:
Any.h:37
icl::math::LinearTransform1D
A standard linear mapping class for the 1D case f(x) = m * x + b.
Definition:
LinearTransform1D.h:40
Range.h
icl::math::LinearTransform1D::m
float m
slope
Definition:
LinearTransform1D.h:42
icl::math::LinearTransform1D::LinearTransform1D
LinearTransform1D(const utils::Range< T > &s, const utils::Range< T > &d)
spedical constructor template with given source and destination range
Definition:
LinearTransform1D.h:52
CompatMacros.h
icl::math::LinearTransform1D::operator()
float operator()(float x) const
applies the mapping to a given x -> f(x) = m * x + b
Definition:
LinearTransform1D.h:57
icl::math::LinearTransform1D::LinearTransform1D
LinearTransform1D(float m=0, float b=0)
base constructor with given parameters m and b
Definition:
LinearTransform1D.h:48
Generated on Mon May 20 2019 12:00:16 for Image Component Library (ICL) by
1.8.15