wuzp
Wrong Unit? Zero Points! Compile-time checks for units, coordinate systems and points vs. vectors.
Toggle main menu visibility
Loading...
Searching...
No Matches
CoordinateSystem.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <concepts>
4
#include <type_traits>
5
6
#include "
wuzp/core/TypeMatrix.hpp
"
7
#include "
wuzp/core/traits.hpp
"
8
9
namespace
wuzp
{
10
18
struct
Euclidean
{};
19
27
struct
Minkowski
{};
28
30
template
<
typename
T>
31
concept
EuclideanOrMinkowski
= std::same_as<T, Euclidean> || std::same_as<T, Minkowski>;
32
41
template
<
typename
IdentifierT_, Eucl
id
eanOrMinkowski MetricT_ = Eucl
id
ean>
42
struct
CoordinateSystem
{};
43
55
template
<
typename
CoordinateSystemT_>
56
struct
Metric
;
57
template
<
typename
IdentifierT_,
typename
MetricT_>
58
struct
Metric
<
CoordinateSystem
<IdentifierT_, MetricT_>> {
59
using
type
= MetricT_;
60
};
61
62
namespace
internal {
63
65
template
<
typename
LhsT_,
typename
RhsT_>
66
struct
SameCoordinateSystem {
67
static_assert
(std::is_same_v<LhsT_, RhsT_>,
"Coordinate systems do not match."
);
68
using
type = LhsT_;
69
};
70
71
}
// namespace internal
72
73
template
<
typename
IdentifierLhsT_,
typename
MetricLhsT_,
typename
IdentifierRhsT_,
typename
MetricRhsT_>
74
struct
Sum<
CoordinateSystem
<IdentifierLhsT_, MetricLhsT_>,
CoordinateSystem
<IdentifierRhsT_, MetricRhsT_>>
75
: internal::SameCoordinateSystem<CoordinateSystem<IdentifierLhsT_, MetricLhsT_>, CoordinateSystem<IdentifierRhsT_, MetricRhsT_>> {};
76
77
template
<
typename
IdentifierLhsT_,
typename
MetricLhsT_,
typename
IdentifierRhsT_,
typename
MetricRhsT_>
78
struct
Difference<
CoordinateSystem
<IdentifierLhsT_, MetricLhsT_>,
CoordinateSystem
<IdentifierRhsT_, MetricRhsT_>>
79
: internal::SameCoordinateSystem<CoordinateSystem<IdentifierLhsT_, MetricLhsT_>, CoordinateSystem<IdentifierRhsT_, MetricRhsT_>> {};
80
81
template
<
typename
IdentifierLhsT_,
typename
MetricLhsT_,
typename
IdentifierRhsT_,
typename
MetricRhsT_>
82
struct
Product<
CoordinateSystem
<IdentifierLhsT_, MetricLhsT_>,
CoordinateSystem
<IdentifierRhsT_, MetricRhsT_>>
83
: internal::SameCoordinateSystem<CoordinateSystem<IdentifierLhsT_, MetricLhsT_>, CoordinateSystem<IdentifierRhsT_, MetricRhsT_>> {};
84
85
template
<
typename
IdentifierLhsT_,
typename
MetricLhsT_,
typename
IdentifierRhsT_,
typename
MetricRhsT_>
86
struct
Division<
CoordinateSystem
<IdentifierLhsT_, MetricLhsT_>,
CoordinateSystem
<IdentifierRhsT_, MetricRhsT_>>
87
: internal::SameCoordinateSystem<CoordinateSystem<IdentifierLhsT_, MetricLhsT_>, CoordinateSystem<IdentifierRhsT_, MetricRhsT_>> {};
88
89
}
// namespace wuzp
TypeMatrix.hpp
wuzp::EuclideanOrMinkowski
The metric of a coordinate system: Euclidean or Minkowski.
Definition
CoordinateSystem.hpp:31
traits.hpp
wuzp
Definition
Absolute.hpp:15
wuzp::CoordinateSystem
A coordinate system: axes, an origin and a metric, as a type without runtime cost.
Definition
CoordinateSystem.hpp:42
wuzp::Euclidean
The Euclidean metric delta_ij of a coordinate system with orthonormal axes, e.g. of space in Cartesia...
Definition
CoordinateSystem.hpp:18
wuzp::Metric< CoordinateSystem< IdentifierT_, MetricT_ > >::type
MetricT_ type
Definition
CoordinateSystem.hpp:59
wuzp::Metric
The metric of a coordinate system, Euclidean or Minkowski, its second template parameter,...
Definition
CoordinateSystem.hpp:56
wuzp::Minkowski
The Minkowski metric eta = diag(1, -1, ..., -1) of an inertial frame of special relativity,...
Definition
CoordinateSystem.hpp:27
wuzp
include
wuzp
core
CoordinateSystem.hpp
Generated by
1.18.0