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