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>
85 template <
typename VE>
87 bool do_center =
true, std::size_t max_svd_iter = 0)
90 return kabschAlgo.
align(MatrixVectorArrayAdapter(points), MatrixVectorArrayAdapter(ref_points),
91 weights, do_center, max_svd_iter);
103 bool do_center =
true, std::size_t max_svd_iter = 0)
106 return kabschAlgo.
align(MatrixVectorArrayAdapter(points), MatrixVectorArrayAdapter(ref_points),
107 do_center, max_svd_iter);
120 class MatrixVectorArrayAdapter :
public MatrixExpression<MatrixVectorArrayAdapter>
123 typedef MatrixVectorArrayAdapter SelfType;
129 typedef typename VectorArrayType::SizeType SizeType;
130 typedef std::ptrdiff_t DifferenceType;
131 typedef SelfType ClosureType;
132 typedef const SelfType ConstClosureType;
137 Reference operator()(SizeType i, SizeType j)
139 return data.getData()[j].getData()[i];
142 ConstReference operator()(SizeType i, SizeType j)
const
147 SizeType getSize1()
const
149 return VectorType::Size;
152 SizeType getSize2()
const
154 return data.getSize();
157 SizeType getMaxSize()
const
159 return data.getMaxSize();
162 SizeType getMaxSize1()
const
164 return VectorType::Size;
167 SizeType getMaxSize2()
const
169 return data.getMaxSize();
174 return data.isEmpty();
187 MatrixVectorArrayAdapter& operator=(
const MatrixVectorArrayAdapter& a)
189 data.operator=(a.data);
193 void swap(MatrixVectorArrayAdapter& a)
198 friend void swap(MatrixVectorArrayAdapter& a1, MatrixVectorArrayAdapter& a2)
207 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:214
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:97
CRTP base class of all matrix expression types.
Definition: Expression.hpp:108
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:114
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:86
T ValueType
The scalar value type.
Definition: VectorArrayAlignmentCalculator.hpp:68
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:102
V VectorType
The vector element type of VectorArrayType.
Definition: VectorArrayAlignmentCalculator.hpp:63
VA VectorArrayType
The vector-array type.
Definition: VectorArrayAlignmentCalculator.hpp:58
KabschAlgorithm< ValueType >::MatrixType MatrixType
The matrix type used for the computed transformation.
Definition: VectorArrayAlignmentCalculator.hpp:73
CRTP base class of all vector expression types.
Definition: Expression.hpp:68
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.