wuzp
Wrong Unit? Zero Points! Compile-time checks for units, coordinate systems and points vs. vectors.
Toggle main menu visibility
Loading...
Searching...
No Matches
traits.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <type_traits>
4
5
#include "
wuzp/core/helpers.hpp
"
6
#include "
wuzp/trafo/Transformation.hpp
"
7
8
namespace
wuzp
{
9
18
template
<
typename
TransformationT_,
typename
Object>
19
struct
TransformationTraits
{
20
static_assert
(
AnyTransformation<Object>
||
FailOnInstantiation<TransformationTraits<TransformationT_, Object>
>::value,
21
"'TransformationTraits' trait not specialized."
);
22
static_assert
(!
AnyTransformation<Object>
,
23
"This transformation does not transform this transformation. Compose transformations with operator*."
);
24
};
25
38
template
<
typename
LhsT_,
typename
RhsT_>
39
struct
CompositionTraits
{
40
static_assert
(
FailOnInstantiation<CompositionTraits<LhsT_, RhsT_>
>::value,
"These transformations cannot be composed."
);
41
};
42
55
template
<
typename
ValueT_>
56
struct
ValidityTolerance
{
57
static_assert
(std::is_integral_v<ValueT_>,
"'ValidityTolerance' trait not specialized for given types."
);
58
static
constexpr
ValueT_
value
() {
return
0; }
59
};
60
61
template
<>
62
struct
ValidityTolerance
<float> {
63
static
constexpr
float
value
() {
return
1e-4f; }
64
};
65
66
template
<>
67
struct
ValidityTolerance
<double> {
68
static
constexpr
double
value
() {
return
1e-9; }
69
};
70
71
template
<>
72
struct
ValidityTolerance
<long double> {
73
static
constexpr
long
double
value
() {
return
ValidityTolerance<double>::value
(); }
74
};
75
76
namespace
internal {
77
79
template
<
typename
T>
80
struct
IsRotation : std::false_type {};
81
85
template
<
typename
T>
86
struct
IsChangeOfBasis : std::false_type {};
87
88
}
// namespace internal
89
92
template
<
typename
T>
93
concept
AnyRotation
= internal::IsRotation<T>::value;
94
95
}
// namespace wuzp
Transformation.hpp
wuzp::AnyRotation
A rotation, i.e. an ActiveSpatialRotation or a PassiveSpatialRotation, whose matrix is orthogonal wit...
Definition
traits.hpp:93
wuzp::AnyTransformation
A transformation of wuzp, i.e. a type that derives from Transformation, also through a class that der...
Definition
Transformation.hpp:42
helpers.hpp
wuzp
Definition
Absolute.hpp:15
wuzp::CompositionTraits
The composition lhs * rhs of two transformations, which applies rhs first, then lhs: (lhs * rhs)....
Definition
traits.hpp:39
wuzp::FailOnInstantiation
False for every type, so that a static_assert on it fails only when the template that names it is ins...
Definition
helpers.hpp:21
wuzp::TransformationTraits
How a transformation transforms an object: static auto transform(const TransformationT_&,...
Definition
traits.hpp:19
wuzp::ValidityTolerance< double >::value
static constexpr double value()
Definition
traits.hpp:68
wuzp::ValidityTolerance< float >::value
static constexpr float value()
Definition
traits.hpp:63
wuzp::ValidityTolerance< long double >::value
static constexpr long double value()
Definition
traits.hpp:73
wuzp::ValidityTolerance
The tolerance of the validity checks of rotations and Lorentz transformations, for values of the type...
Definition
traits.hpp:56
wuzp::ValidityTolerance::value
static constexpr ValueT_ value()
Definition
traits.hpp:58
wuzp
include
wuzp
trafo
traits.hpp
Generated by
1.18.0