wuzp
Wrong Unit? Zero Points! Compile-time checks for units, coordinate systems and points vs. vectors.
Loading...
Searching...
No Matches
ActiveTransformation.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <type_traits>
4#include <utility>
5
10
11namespace wuzp {
12
14template <typename DerivedT_>
15class ActiveTransformation : public internal::Crtp<DerivedT_, Transformation<DerivedT_>> {
16 public:
18 template <typename ObjectT_>
19 auto transform(ObjectT_&& object) const {
20 return TransformationTraits<DerivedT_, std::remove_cvref_t<ObjectT_>>::transform(this->derived(), std::forward<ObjectT_>(object));
21 }
22};
23
28template <typename LhsT_, typename RhsT_>
30 static_assert(std::is_same_v<typename GetCoordinateSystem<LhsT_>::type, typename GetCoordinateSystem<RhsT_>::type>,
31 "Coordinate systems do not match.");
32 return CompositionTraits<LhsT_, RhsT_>::compose(static_cast<const LhsT_&>(lhs), static_cast<const RhsT_&>(rhs));
33}
34
35} // namespace wuzp
An active transformation, which moves objects within its coordinate system (see Transformation).
auto transform(ObjectT_ &&object) const
The transformed object. A temporary is passed on as one, like with PassiveTransformation::transform()...
auto operator*(const Quantities< ValuesLhsT_, UnitsLhsT_ > &lhs, const ValueRhsT_ rhs)
The composition lhs * rhs of two transformations, which applies rhs first, then lhs: (lhs * rhs)....
Definition traits.hpp:39
How a transformation transforms an object: static auto transform(const TransformationT_&,...
Definition traits.hpp:19