27 #ifndef CDPL_MATH_VECTORARRAYALIGNMENTCALCULATOR_HPP
28 #define CDPL_MATH_VECTORARRAYALIGNMENTCALCULATOR_HPP
50 template <
typename VA,
typename V =
typename VA::ElementType,
typename T =
typename V::ValueType>
74 template <
typename VE>
76 bool do_center =
true, std::size_t max_svd_iter = 0)
79 return kabschAlgo.
align(MatrixVectorArrayAdapter(points), MatrixVectorArrayAdapter(ref_points),
80 weights, do_center, max_svd_iter);
92 bool do_center =
true, std::size_t max_svd_iter = 0)
95 return kabschAlgo.
align(MatrixVectorArrayAdapter(points), MatrixVectorArrayAdapter(ref_points),
96 do_center, max_svd_iter);
109 class MatrixVectorArrayAdapter :
public MatrixExpression<MatrixVectorArrayAdapter>
112 typedef MatrixVectorArrayAdapter SelfType;
118 typedef typename VectorArrayType::SizeType SizeType;
119 typedef std::ptrdiff_t DifferenceType;
120 typedef SelfType ClosureType;
121 typedef const SelfType ConstClosureType;
126 Reference operator()(SizeType i, SizeType j)
128 return data.getData()[j].getData()[i];
131 ConstReference operator()(SizeType i, SizeType j)
const
136 SizeType getSize1()
const
138 return VectorType::Size;
141 SizeType getSize2()
const
143 return data.getSize();
146 SizeType getMaxSize()
const
148 return data.getMaxSize();
151 SizeType getMaxSize1()
const
153 return VectorType::Size;
156 SizeType getMaxSize2()
const
158 return data.getMaxSize();
163 return data.isEmpty();
176 MatrixVectorArrayAdapter& operator=(
const MatrixVectorArrayAdapter& a)
178 data.operator=(a.data);
182 void swap(MatrixVectorArrayAdapter& a)
187 friend void swap(MatrixVectorArrayAdapter& a1, MatrixVectorArrayAdapter& a2)
196 KabschAlgorithm<ValueType> kabschAlgo;
Implementation of the Kabsch algorithm.
Definition of various matrix expression types and operations.
Definition of various vector expression types and operations.
Implementation of the Kabsch algorithm [KABA].
Definition: KabschAlgorithm.hpp:62
const MatrixType & getTransform() const
Returns the rigid-body transformation produced by the most recent successful align() call.
Definition: KabschAlgorithm.hpp:206
bool align(const MatrixExpression< M1 > &points, const MatrixExpression< M2 > &ref_points, const VectorExpression< V > &weights, bool do_center=true, std::size_t max_svd_iter=0)
Computes the rigid body transformation that aligns a set of -dimensional points points with a corres...
Definition: KabschAlgorithm.hpp:89
CRTP base class for all matrix expression types.
Definition: Expression.hpp:104
Convenience wrapper around Math::KabschAlgorithm that operates directly on Math::VectorArray inputs.
Definition: VectorArrayAlignmentCalculator.hpp:52
const MatrixType & getTransform() const
Returns the rigid-body transformation produced by the most recent successful calculate() call.
Definition: VectorArrayAlignmentCalculator.hpp:103
bool calculate(const VectorArrayType &points, const VectorArrayType &ref_points, const VectorExpression< VE > &weights, bool do_center=true, std::size_t max_svd_iter=0)
Aligns points onto ref_points (with per-point weights) using the Kabsch algorithm.
Definition: VectorArrayAlignmentCalculator.hpp:75
T ValueType
The scalar value type.
Definition: VectorArrayAlignmentCalculator.hpp:60
bool calculate(const VectorArrayType &points, const VectorArrayType &ref_points, bool do_center=true, std::size_t max_svd_iter=0)
Aligns points onto ref_points (with uniform weights) using the Kabsch algorithm.
Definition: VectorArrayAlignmentCalculator.hpp:91
V VectorType
The vector element type of VectorArrayType.
Definition: VectorArrayAlignmentCalculator.hpp:58
VA VectorArrayType
The vector-array type.
Definition: VectorArrayAlignmentCalculator.hpp:56
KabschAlgorithm< ValueType >::MatrixType MatrixType
The matrix type used for the computed transformation.
Definition: VectorArrayAlignmentCalculator.hpp:62
CRTP base class for all vector expression types.
Definition: Expression.hpp:66
constexpr unsigned int V
Specifies Vanadium.
Definition: AtomType.hpp:177
constexpr unsigned int T
Specifies Hydrogen (Tritium).
Definition: AtomType.hpp:67
The namespace of the Chemical Data Processing Library.