PoDoFo 1.0.0-dev
Loading...
Searching...
No Matches
MathBase.h
1
7#ifndef AUX_MATH_BASE_H
8#define AUX_MATH_BASE_H
9
10namespace PoDoFo
11{
12 enum class AlgebraicTrait
13 {
14 Tx,
15 Ty,
16 // TODO: Scale/Rotation traits
17 };
18
21
22 template <AlgebraicTrait>
23 struct MatrixTraits;
24
25 template <>
26 struct MatrixTraits<Tx>
27 {
28 static double Get(const double m[6])
29 {
30 return m[4];
31 }
32
33 static void Set(double m[6], double value)
34 {
35 m[4] = value;
36 }
37
38 static void Apply(double m[6], double value)
39 {
40 m[4] = value * m[0] + m[4];
41 }
42 };
43
44 template <>
45 struct MatrixTraits<Ty>
46 {
47 static double Get(const double m[6])
48 {
49 return m[5];
50 }
51
52 static void Set(double m[6], double value)
53 {
54 m[5] = value;
55 }
56
57 static void Apply(double m[6], double value)
58 {
59 m[5] = value * m[3] + m[5];
60 }
61 };
62}
63
64#endif // AUX_MATH_BASE_H
SPDX-FileCopyrightText: (C) 2022 Francesco Pretto ceztko@gmail.com SPDX-License-Identifier: LGPL-2....
Definition basetypes.h:16
AlgebraicTrait
Definition MathBase.h:13
@ Tx
X Translation.
@ Ty
Y Translation.
constexpr AlgebraicTrait Ty
X Translation trait.
Definition MathBase.h:20
constexpr AlgebraicTrait Tx
X Translation trait.
Definition MathBase.h:19