PX4 Firmware
PX4 Autopilot Software http://px4.io
Scalar.hpp
Go to the documentation of this file.
1
/**
2
* @file Scalar.hpp
3
*
4
* Defines conversion of matrix to scalar.
5
*
6
* @author James Goppert <james.goppert@gmail.com>
7
*/
8
9
#pragma once
10
11
#include "
math.hpp
"
12
13
namespace
matrix
14
{
15
16
template
<
typename
Type>
17
class
Scalar
18
{
19
public
:
20
Scalar
() =
delete
;
21
22
Scalar
(
const
Matrix<Type, 1, 1>
& other) :
23
_value
{other(0,0)}
24
{
25
}
26
27
Scalar
(Type other) :
_value
(other)
28
{
29
}
30
31
operator
const
Type &()
32
{
33
return
_value
;
34
}
35
36
operator
Matrix<Type, 1, 1>
()
const
{
37
Matrix<Type, 1, 1>
m;
38
m(0, 0) =
_value
;
39
return
m;
40
}
41
42
operator
Vector<Type, 1>
()
const
{
43
Vector<Type, 1>
m;
44
m(0) =
_value
;
45
return
m;
46
}
47
48
private
:
49
const
Type
_value
;
50
51
};
52
53
typedef
Scalar<float>
Scalarf
;
54
55
}
// namespace matrix
56
57
/* vim: set et fenc=utf-8 ff=unix sts=0 sw=4 ts=4 : */
matrix::Vector
Definition:
Dual.hpp:22
matrix::Scalar::Scalar
Scalar(const Matrix< Type, 1, 1 > &other)
Definition:
Scalar.hpp:22
matrix::Scalar::Scalar
Scalar()=delete
matrix::Scalar
Definition:
Scalar.hpp:17
matrix
Definition:
AxisAngle.hpp:11
matrix::Scalarf
Scalar< float > Scalarf
Definition:
Scalar.hpp:53
math.hpp
matrix::Scalar::_value
const Type _value
Definition:
Scalar.hpp:49
matrix::Scalar::Scalar
Scalar(Type other)
Definition:
Scalar.hpp:27
matrix::Matrix
Definition:
Matrix.hpp:36
src
lib
matrix
matrix
Scalar.hpp
Generated by
1.8.13