21template <
typename LhsT_,
typename RhsT_,
22 bool BothMeasuredInV_ =
24 typename LhsT_::MeasuredInT;
25 typename RhsT_::MeasuredInT;
27struct SameMeasuredIn : std::true_type {};
28template <
typename LhsT_,
typename RhsT_>
29struct SameMeasuredIn<LhsT_, RhsT_, true> {
30 static_assert(std::is_same_v<typename LhsT_::MeasuredInT, typename RhsT_::MeasuredInT>,
"Measured-in frames do not match.");
31 static constexpr bool value =
true;
37template <
typename LhsT_,
typename RhsT_>
38struct SameSpatialTagsExceptPoint {
39 static_assert(SameMeasuredIn<LhsT_, RhsT_>::value);
40 static_assert(std::is_same_v<typename LhsT_::FrameT, typename RhsT_::FrameT>,
"Frames do not match.");
41 static_assert(std::is_same_v<typename LhsT_::ExpressedInT, typename RhsT_::ExpressedInT>,
"Coordinate systems do not match.");
42 static constexpr bool value =
true;
49template <
typename LhsT_,
typename RhsT_>
50struct SameSpatialTags {
51 static_assert(SameSpatialTagsExceptPoint<LhsT_, RhsT_>::value);
52 static_assert(std::is_same_v<typename LhsT_::PointT, typename RhsT_::PointT>,
"Reference points do not match.");
53 static constexpr bool value =
true;
76template <
typename DerivedT_, AnyTensor RotationalT_, AnyTensor TranslationalT_>
84 using ValueT =
typename RotationalT_::ValueT;
106 template <
typename OtherT_,
typename RotationalOtherT_,
typename TranslationalOtherT_>
109 static_assert(internal::SameSpatialTags<DerivedT_, OtherT_>::value);
117 template <
typename RotationalOtherT_,
typename TranslationalOtherT_>
118 SpatialVector(RotationalOtherT_&& rotational, TranslationalOtherT_&& translational)
119 : rotational_(std::forward<RotationalOtherT_>(rotational)), translational_(std::forward<TranslationalOtherT_>(translational)) {}
131template <
typename DerivedT_,
typename RotationalT_,
typename TranslationalT_>
138concept AnySpatialVector =
requires(
const T& spatialVector) { internal::deduceSpatialVector(spatialVector); };
144template <
typename SpatialVectorT_,
typename NewExpressedInT_>
145struct WithExpressedIn;
151template <
typename NewExpressedInT_,
typename TransformationT_,
typename SpatialVectorT_>
152auto reexpress(
const TransformationT_& transformation,
const SpatialVectorT_& spatialVector) {
153 return typename WithExpressedIn<SpatialVectorT_, NewExpressedInT_>::type{transformation.transform(spatialVector.getRotational()),
154 transformation.transform(spatialVector.getTranslational())};
162template <
typename FromT_,
typename ToT_,
typename RotationT_,
typename TranslationT_,
typename SpatialVectorT_>
163auto adjointMap(
const PassiveProperRigidTransformationTemplate<FromT_, ToT_, RotationT_, TranslationT_>& transformation,
164 const SpatialVectorT_& spatialVector) {
165 static_assert(std::is_same_v<typename SpatialVectorT_::PointT, FromT_>,
166 "The adjoint map of the rigid transformation X_AB maps spatial vectors about the origin of B, expressed in B, to the "
167 "origin of A, expressed in A: shift() them to the origin of B first.");
168 static_assert(std::is_same_v<typename SpatialVectorT_::ExpressedInT, FromT_>,
"Coordinate systems do not match.");
169 return transformation.transform(spatialVector).template shift<ToT_>(-transformation.getTranslation().getTensor());
175template <
typename LhsT_,
typename RotationalLhsT_,
typename TranslationalLhsT_,
typename RhsT_,
typename RotationalRhsT_,
176 typename TranslationalRhsT_>
179 static_assert(internal::SameSpatialTags<LhsT_, RhsT_>::value);
184template <
typename LhsT_,
typename RotationalLhsT_,
typename TranslationalLhsT_,
typename RhsT_,
typename RotationalRhsT_,
185 typename TranslationalRhsT_>
188 return !(lhs == rhs);
193template <
typename LhsT_,
typename RotationalLhsT_,
typename TranslationalLhsT_,
typename RhsT_,
typename RotationalRhsT_,
194 typename TranslationalRhsT_>
197 static_assert(internal::SameSpatialTags<LhsT_, RhsT_>::value);
202template <
typename LhsT_,
typename RotationalLhsT_,
typename TranslationalLhsT_,
typename RhsT_,
typename RotationalRhsT_,
203 typename TranslationalRhsT_>
206 static_assert(internal::SameSpatialTags<LhsT_, RhsT_>::value);
211template <
typename DerivedT_,
typename RotationalT_,
typename TranslationalT_>
218template <
template <
typename,
int,
int>
typename ValuesT_,
typename ValueT_,
typename FromT_,
typename ToT_,
typename SpatialVectorT_>
219 requires AnySpatialVector<SpatialVectorT_>
222 return internal::reexpress<ToT_>(rotation, spatialVector);
229template <
template <
typename,
int,
int>
typename ValuesT_,
int DimensionV_,
typename ValueT_,
typename FromT_,
typename ToT_,
230 typename... UnitsT_,
typename SpatialVectorT_>
231 requires AnySpatialVector<SpatialVectorT_>
234 const SpatialVectorT_& spatialVector) {
235 return internal::reexpress<ToT_>(translation, spatialVector);
A passive rotation from the coordinate system From to the coordinate system To, which have the same o...
A passive translation from the coordinate system From to the coordinate system To,...
The base class of the spatial vectors SpatialVelocity, SpatialAcceleration and SpatialForce: a rotati...
const TranslationalT & getTranslational() const &
The translational part, e.g. the velocity of the point of a spatial velocity.
TranslationalT_ TranslationalT
const RotationalT & getRotational() const &
The rotational part, e.g. the angular velocity of a spatial velocity.
SpatialVector & operator=(const SpatialVector &)=default
TranslationalT getTranslational() &&
The translational part of a temporary is moved out of it.
RotationalT getRotational() &&
The rotational part of a temporary is moved out of it.
SpatialVector(SpatialVector &&)=default
typename RotationalT_::ValueT ValueT
bool isApprox(const SpatialVector< OtherT_, RotationalOtherT_, TranslationalOtherT_ > &other, const ValueT precision=Precision< ValueT >::value()) const
Whether both spatial vectors, which must have the same tags, are approximately equal: their rotationa...
SpatialVector & operator=(SpatialVector &&)=default
SpatialVector(const SpatialVector &)=default
SpatialVector(RotationalOtherT_ &&rotational, TranslationalOtherT_ &&translational)
Direct-initializes each part, so that a part of the wrong kind, e.g. a velocity as an angular velocit...
A spatial vector of wuzp, i.e. a type that derives from SpatialVector: SpatialVelocity,...
auto operator+(const Quantities< ValuesLhsT_, UnitsLhsT_ > &lhs, const Quantities< ValuesRhsT_, UnitsRhsT_ > &rhs)
bool operator!=(const Quantities< ValuesLhsT_, UnitsLhsT_ > &lhs, const Quantities< ValuesRhsT_, UnitsRhsT_ > &rhs)
std::ostream & operator<<(std::ostream &lhs, const Quantities< ValuesT_, UnitsT_ > &rhs)
auto operator-(const Quantities< ValuesLhsT_, UnitsLhsT_ > &lhs, const Quantities< ValuesRhsT_, UnitsRhsT_ > &rhs)
bool operator==(const Quantities< ValuesLhsT_, UnitsLhsT_ > &lhs, const Quantities< ValuesRhsT_, UnitsRhsT_ > &rhs)
static constexpr ValueT_ value()