23 template <
typename Real>
26 public ApprQuery<Real, ApprHeightPlane3<Real>, Vector3<Real>>
41 std::vector<int>
const&
indices);
48 template <
typename Real>
55 template <
typename Real>
62 for (
int i = 0; i < numPoints; ++i)
66 mean /= (Real)numPoints;
69 Real covar00 = (Real)0, covar01 = (Real)0, covar02 = (Real)0;
70 Real covar11 = (Real)0, covar12 = (Real)0;
71 for (
int i = 0; i < numPoints; ++i)
74 covar00 += diff[0] * diff[0];
75 covar01 += diff[0] * diff[1];
76 covar02 += diff[0] * diff[2];
77 covar11 += diff[1] * diff[1];
78 covar12 += diff[1] * diff[2];
82 Real det = covar00*covar11 - covar01*covar01;
85 Real invDet = ((Real)1) / det;
88 (covar11*covar02 - covar01*covar12)*invDet;
90 (covar00*covar12 - covar01*covar02)*invDet;
101 template <
typename Real>
108 template <
typename Real>
114 template <
typename Real>
122 template <
typename Real>
125 std::vector<int>
const&
indices)
131 for (
auto index : indices)
133 mean += observations[
index];
135 mean /= (Real)indices.size();
138 Real covar00 = (Real)0, covar01 = (Real)0, covar02 = (Real)0;
139 Real covar11 = (Real)0, covar12 = (Real)0;
140 for (
auto index : indices)
143 covar00 += diff[0] * diff[0];
144 covar01 += diff[0] * diff[1];
145 covar02 += diff[0] * diff[2];
146 covar11 += diff[1] * diff[1];
147 covar12 += diff[1] * diff[2];
151 Real det = covar00*covar11 - covar01*covar01;
154 Real invDet = ((Real)1) / det;
157 (covar11*covar02 - covar01*covar12)*invDet;
159 (covar00*covar12 - covar01*covar02)*invDet;
GLfixed GLfixed GLint GLint GLfixed points
GLsizei GLenum const void * indices
std::pair< Vector3< Real >, Vector3< Real > > mParameters
DualQuaternion< Real > Dot(DualQuaternion< Real > const &d0, DualQuaternion< Real > const &d1)
Real Error(Vector3< Real > const &observation) const
int GetMinimumRequired() const
std::pair< Vector3< Real >, Vector3< Real > > const & GetParameters() const
bool Fit(int numPoints, Vector3< Real > const *points)