wuzp
Wrong Unit? Zero Points! Compile-time checks for units, coordinate systems and points vs. vectors.
Toggle main menu visibility
Loading...
Searching...
No Matches
ActiveProperRigidTransformationTemplate.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <type_traits>
4
#include <utility>
5
6
#include "
wuzp/core/concepts.hpp
"
7
#include "
wuzp/core/traits.hpp
"
8
#include "
wuzp/trafo/ActiveTransformation.hpp
"
9
#include "
wuzp/trafo/ActiveTranslation.hpp
"
10
#include "wuzp/trafo/internal/rigid.hpp"
11
#include "
wuzp/trafo/traits.hpp
"
12
13
namespace
wuzp
{
14
25
template
<Eucl
id
eanCoordinateSystem CoordinateSystemT_, AnyRotation RotationT_,
typename
TranslationT_>
26
class
ActiveProperRigidTransformationTemplate
27
:
public
ActiveTransformation
<ActiveProperRigidTransformationTemplate<CoordinateSystemT_, RotationT_, TranslationT_>> {
28
public
:
29
using
Rotation
= RotationT_;
30
using
Translation
= TranslationT_;
31
using
ValueT
=
typename
Rotation::ValueT;
32
33
ActiveProperRigidTransformationTemplate
() =
default
;
34
ActiveProperRigidTransformationTemplate
(
Rotation
rotation,
Translation
translation)
35
: rotation_{std::move(rotation)}, translation_{std::move(translation)} {}
36
37
void
setRotation
(
const
Rotation
& rotation) { rotation_ = rotation; }
38
const
Rotation
&
getRotation
()
const
{
return
rotation_; }
39
40
void
setTranslation
(
const
Translation
& translation) { translation_ = translation; }
41
const
Translation
&
getTranslation
()
const
{
return
translation_; }
42
44
ActiveProperRigidTransformationTemplate
inverse
()
const
{
return
internal::invertRigid<ActiveProperRigidTransformationTemplate>(*
this
); }
45
48
template
<
typename
CoordinateSystemOtherT_,
typename
RotationOtherT_,
typename
TranslationOtherT_>
49
bool
isApprox
(
const
ActiveProperRigidTransformationTemplate<CoordinateSystemOtherT_, RotationOtherT_, TranslationOtherT_>
& other,
50
const
ValueT
precision =
Precision<ValueT>::value
())
const
{
51
static_assert
(std::is_same_v<CoordinateSystemT_, CoordinateSystemOtherT_>,
"Coordinate systems do not match."
);
52
return
rotation_.isApprox(other.
getRotation
(), precision) && translation_.isApprox(other.
getTranslation
(), precision);
53
}
54
55
private
:
56
Rotation
rotation_;
57
Translation
translation_;
58
};
59
60
template
<
typename
CoordinateSystemT_,
typename
RotationT_,
typename
TranslationT_>
61
struct
GetCoordinateSystem
<
ActiveProperRigidTransformationTemplate
<CoordinateSystemT_, RotationT_, TranslationT_>> {
62
using
type
= CoordinateSystemT_;
63
};
64
65
template
<
typename
CoordinateSystemT_,
typename
RotationT_,
typename
TranslationT_,
typename
Object>
66
struct
TransformationTraits
<
ActiveProperRigidTransformationTemplate
<CoordinateSystemT_, RotationT_, TranslationT_>, Object> {
67
static
auto
transform
(
const
ActiveProperRigidTransformationTemplate<CoordinateSystemT_, RotationT_, TranslationT_>
& transformation,
68
const
Object&
object
) {
69
return
transformation.
getTranslation
().transform(transformation.
getRotation
().transform(
object
));
70
}
71
};
72
73
// The compositions of proper rigid transformations with each other and with translations are proper rigid transformations of the
74
// type of the proper rigid operand (see internal/rigid.hpp).
75
76
template
<
typename
CoordinateSystemLhsT_,
typename
RotationLhsT_,
typename
TranslationLhsT_,
typename
CoordinateSystemRhsT_,
77
typename
RotationRhsT_,
typename
TranslationRhsT_>
78
struct
CompositionTraits
<
ActiveProperRigidTransformationTemplate
<CoordinateSystemLhsT_, RotationLhsT_, TranslationLhsT_>,
79
ActiveProperRigidTransformationTemplate
<CoordinateSystemRhsT_, RotationRhsT_, TranslationRhsT_>> {
80
using
ResultT
=
ActiveProperRigidTransformationTemplate<CoordinateSystemLhsT_, RotationLhsT_, TranslationLhsT_>
;
81
static
ResultT
compose
(
const
ResultT
& lhs,
82
const
ActiveProperRigidTransformationTemplate<CoordinateSystemRhsT_, RotationRhsT_, TranslationRhsT_>
& rhs) {
83
return
internal::composeRigid<ResultT>(lhs, rhs);
84
}
85
};
86
87
template
<
typename
CoordinateSystemT_,
typename
RotationT_,
typename
TranslationT_,
template
<
typename
,
int
,
int
>
typename
ValuesRhsT_,
88
int
DimensionRhsV_,
typename
ValueRhsT_,
typename
CoordinateSystemRhsT_,
typename
... UnitsRhsT_>
89
struct
CompositionTraits
<
ActiveProperRigidTransformationTemplate
<CoordinateSystemT_, RotationT_, TranslationT_>,
90
ActiveTranslation
<ValuesRhsT_, DimensionRhsV_, ValueRhsT_, CoordinateSystemRhsT_, UnitsRhsT_...>> {
91
using
ResultT
=
ActiveProperRigidTransformationTemplate<CoordinateSystemT_, RotationT_, TranslationT_>
;
92
static
ResultT
compose
(
const
ResultT
& lhs,
93
const
ActiveTranslation<ValuesRhsT_, DimensionRhsV_, ValueRhsT_, CoordinateSystemRhsT_, UnitsRhsT_...>
& rhs) {
94
return
internal::composeRigidAndTranslation<ResultT>(lhs, rhs);
95
}
96
};
97
98
template
<
template
<
typename
,
int
,
int
>
typename
ValuesLhsT_,
int
DimensionLhsV_,
typename
ValueLhsT_,
typename
CoordinateSystemLhsT_,
99
typename
... UnitsLhsT_,
typename
CoordinateSystemT_,
typename
RotationT_,
typename
TranslationT_>
100
struct
CompositionTraits
<
ActiveTranslation
<ValuesLhsT_, DimensionLhsV_, ValueLhsT_, CoordinateSystemLhsT_, UnitsLhsT_...>,
101
ActiveProperRigidTransformationTemplate
<CoordinateSystemT_, RotationT_, TranslationT_>> {
102
using
ResultT
=
ActiveProperRigidTransformationTemplate<CoordinateSystemT_, RotationT_, TranslationT_>
;
103
static
ResultT
compose
(
const
ActiveTranslation<ValuesLhsT_, DimensionLhsV_, ValueLhsT_, CoordinateSystemLhsT_, UnitsLhsT_...>
& lhs,
104
const
ResultT
& rhs) {
105
return
internal::composeTranslationAndRigid<ResultT>(lhs, rhs);
106
}
107
};
108
109
}
// namespace wuzp
ActiveTransformation.hpp
ActiveTranslation.hpp
wuzp::ActiveProperRigidTransformationTemplate
An active proper rigid transformation, which first rotates, then translates: x -> R x + t,...
Definition
ActiveProperRigidTransformationTemplate.hpp:27
wuzp::ActiveProperRigidTransformationTemplate< CoordinateSystemT_, ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >, ActiveSpatialTranslation< ValuesT_, DimensionV_, ValueT_, CoordinateSystemT_ > >::getRotation
const Rotation & getRotation() const
Definition
ActiveProperRigidTransformationTemplate.hpp:38
wuzp::ActiveProperRigidTransformationTemplate< CoordinateSystemT_, ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >, ActiveSpatialTranslation< ValuesT_, DimensionV_, ValueT_, CoordinateSystemT_ > >< ValuesT_, 2, CoordinateSystemT_, ValueT_ >::Rotation
RotationT_ Rotation
Definition
ActiveProperRigidTransformationTemplate.hpp:29
wuzp::ActiveProperRigidTransformationTemplate< CoordinateSystemT_, ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >, ActiveSpatialTranslation< ValuesT_, DimensionV_, ValueT_, CoordinateSystemT_ > >::isApprox
bool isApprox(const ActiveProperRigidTransformationTemplate< CoordinateSystemOtherT_, RotationOtherT_, TranslationOtherT_ > &other, const ValueT precision=Precision< ValueT >::value()) const
Definition
ActiveProperRigidTransformationTemplate.hpp:49
wuzp::ActiveProperRigidTransformationTemplate< CoordinateSystemT_, ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >, ActiveSpatialTranslation< ValuesT_, DimensionV_, ValueT_, CoordinateSystemT_ > >::setRotation
void setRotation(const Rotation &rotation)
Definition
ActiveProperRigidTransformationTemplate.hpp:37
wuzp::ActiveProperRigidTransformationTemplate< CoordinateSystemT_, ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >, ActiveSpatialTranslation< ValuesT_, DimensionV_, ValueT_, CoordinateSystemT_ > >::inverse
ActiveProperRigidTransformationTemplate inverse() const
Definition
ActiveProperRigidTransformationTemplate.hpp:44
wuzp::ActiveProperRigidTransformationTemplate< CoordinateSystemT_, ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >, ActiveSpatialTranslation< ValuesT_, DimensionV_, ValueT_, CoordinateSystemT_ > >::ActiveProperRigidTransformationTemplate
ActiveProperRigidTransformationTemplate(Rotation rotation, Translation translation)
Definition
ActiveProperRigidTransformationTemplate.hpp:34
wuzp::ActiveProperRigidTransformationTemplate< CoordinateSystemT_, ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >, ActiveSpatialTranslation< ValuesT_, DimensionV_, ValueT_, CoordinateSystemT_ > >< ValuesT_, 2, CoordinateSystemT_, ValueT_ >::ValueT
typename Rotation::ValueT ValueT
Definition
ActiveProperRigidTransformationTemplate.hpp:31
wuzp::ActiveProperRigidTransformationTemplate< CoordinateSystemT_, ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >, ActiveSpatialTranslation< ValuesT_, DimensionV_, ValueT_, CoordinateSystemT_ > >< ValuesT_, 2, CoordinateSystemT_, ValueT_ >::Translation
ActiveSpatialTranslation< ValuesT_, DimensionV_, ValueT_, CoordinateSystemT_ > Translation
Definition
ActiveProperRigidTransformationTemplate.hpp:30
wuzp::ActiveProperRigidTransformationTemplate< CoordinateSystemT_, ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >, ActiveSpatialTranslation< ValuesT_, DimensionV_, ValueT_, CoordinateSystemT_ > >::setTranslation
void setTranslation(const Translation &translation)
Definition
ActiveProperRigidTransformationTemplate.hpp:40
wuzp::ActiveProperRigidTransformationTemplate< CoordinateSystemT_, ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >, ActiveSpatialTranslation< ValuesT_, DimensionV_, ValueT_, CoordinateSystemT_ > >::getTranslation
const Translation & getTranslation() const
Definition
ActiveProperRigidTransformationTemplate.hpp:41
wuzp::ActiveProperRigidTransformationTemplate::ActiveProperRigidTransformationTemplate
ActiveProperRigidTransformationTemplate()=default
wuzp::ActiveTransformation
An active transformation, which moves objects within its coordinate system (see Transformation).
Definition
ActiveTransformation.hpp:15
wuzp::ActiveTranslation
An active translation, which moves points by a vector t, p' = p + t, and leaves vectors,...
Definition
ActiveTranslation.hpp:29
concepts.hpp
traits.hpp
wuzp
Definition
Absolute.hpp:15
wuzp::CompositionTraits< ActiveProperRigidTransformationTemplate< CoordinateSystemT_, RotationT_, TranslationT_ >, ActiveTranslation< ValuesRhsT_, DimensionRhsV_, ValueRhsT_, CoordinateSystemRhsT_, UnitsRhsT_... > >::ResultT
ActiveProperRigidTransformationTemplate< CoordinateSystemT_, RotationT_, TranslationT_ > ResultT
Definition
ActiveProperRigidTransformationTemplate.hpp:91
wuzp::CompositionTraits< ActiveProperRigidTransformationTemplate< CoordinateSystemT_, RotationT_, TranslationT_ >, ActiveTranslation< ValuesRhsT_, DimensionRhsV_, ValueRhsT_, CoordinateSystemRhsT_, UnitsRhsT_... > >::compose
static ResultT compose(const ResultT &lhs, const ActiveTranslation< ValuesRhsT_, DimensionRhsV_, ValueRhsT_, CoordinateSystemRhsT_, UnitsRhsT_... > &rhs)
Definition
ActiveProperRigidTransformationTemplate.hpp:92
wuzp::CompositionTraits< ActiveProperRigidTransformationTemplate< CoordinateSystemLhsT_, RotationLhsT_, TranslationLhsT_ >, ActiveProperRigidTransformationTemplate< CoordinateSystemRhsT_, RotationRhsT_, TranslationRhsT_ > >::ResultT
ActiveProperRigidTransformationTemplate< CoordinateSystemLhsT_, RotationLhsT_, TranslationLhsT_ > ResultT
Definition
ActiveProperRigidTransformationTemplate.hpp:80
wuzp::CompositionTraits< ActiveProperRigidTransformationTemplate< CoordinateSystemLhsT_, RotationLhsT_, TranslationLhsT_ >, ActiveProperRigidTransformationTemplate< CoordinateSystemRhsT_, RotationRhsT_, TranslationRhsT_ > >::compose
static ResultT compose(const ResultT &lhs, const ActiveProperRigidTransformationTemplate< CoordinateSystemRhsT_, RotationRhsT_, TranslationRhsT_ > &rhs)
Definition
ActiveProperRigidTransformationTemplate.hpp:81
wuzp::CompositionTraits< ActiveTranslation< ValuesLhsT_, DimensionLhsV_, ValueLhsT_, CoordinateSystemLhsT_, UnitsLhsT_... >, ActiveProperRigidTransformationTemplate< CoordinateSystemT_, RotationT_, TranslationT_ > >::compose
static ResultT compose(const ActiveTranslation< ValuesLhsT_, DimensionLhsV_, ValueLhsT_, CoordinateSystemLhsT_, UnitsLhsT_... > &lhs, const ResultT &rhs)
Definition
ActiveProperRigidTransformationTemplate.hpp:103
wuzp::CompositionTraits< ActiveTranslation< ValuesLhsT_, DimensionLhsV_, ValueLhsT_, CoordinateSystemLhsT_, UnitsLhsT_... >, ActiveProperRigidTransformationTemplate< CoordinateSystemT_, RotationT_, TranslationT_ > >::ResultT
ActiveProperRigidTransformationTemplate< CoordinateSystemT_, RotationT_, TranslationT_ > ResultT
Definition
ActiveProperRigidTransformationTemplate.hpp:102
wuzp::CompositionTraits
The composition lhs * rhs of two transformations, which applies rhs first, then lhs: (lhs * rhs)....
Definition
traits.hpp:39
wuzp::GetCoordinateSystem< ActiveProperRigidTransformationTemplate< CoordinateSystemT_, RotationT_, TranslationT_ > >::type
CoordinateSystemT_ type
Definition
ActiveProperRigidTransformationTemplate.hpp:62
wuzp::GetCoordinateSystem
Definition
traits.hpp:293
wuzp::Precision::value
static constexpr ValueT_ value()
Definition
traits.hpp:356
wuzp::TransformationTraits< ActiveProperRigidTransformationTemplate< CoordinateSystemT_, RotationT_, TranslationT_ >, Object >::transform
static auto transform(const ActiveProperRigidTransformationTemplate< CoordinateSystemT_, RotationT_, TranslationT_ > &transformation, const Object &object)
Definition
ActiveProperRigidTransformationTemplate.hpp:67
wuzp::TransformationTraits
How a transformation transforms an object: static auto transform(const TransformationT_&,...
Definition
traits.hpp:19
traits.hpp
wuzp
include
wuzp
trafo
ActiveProperRigidTransformationTemplate.hpp
Generated by
1.18.0