-
Notifications
You must be signed in to change notification settings - Fork 3
/
ThinPlateSpline.hpp
45 lines (34 loc) · 1.03 KB
/
ThinPlateSpline.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#pragma once
#include <Eigen/Core>
#include <Eigen/StdVector>
class ThinPlateSpline {
public:
typedef std::vector<Eigen::Vector3d,
Eigen::aligned_allocator<Eigen::Vector3d>>
PointList;
ThinPlateSpline() {}
ThinPlateSpline(const PointList &src, const PointList &dst);
~ThinPlateSpline() {}
/* Solve */
void solve();
/* Interpolate */
Eigen::Vector3d interpolate(const Eigen::Vector3d &p) const;
/* Source Points */
const PointList &srcPoints() const { return mSrcPoints; }
/* Set Source Points */
void setSrcPoints(const PointList &points) { mSrcPoints = points; }
/* Destination Points */
const PointList &dstPoints() const { return mDstPoints; }
/* Set Destination Points */
void setDstPoints(const PointList &points) { mDstPoints = points; }
protected:
/* Radial Basis Function */
static inline double radialBasis(double r) {
return r == 0.0 ? r : r * r * log(r);
}
/* Data */
PointList mSrcPoints;
PointList mDstPoints;
Eigen::MatrixXd mW;
Eigen::MatrixXd mL;
};