Skip to content

There is a error in fitQuadric at master branch #127

@vic1314

Description

@vic1314

Describe the bug
Neighbourhood::computeQuadric are fitting a quadric equation z = c1 + c2x +c3y + c4xx + c5xy + c6 * y*y.
but the code is

	//for every points
	{
		double* _A = A.data();
		double* _b = b.data();
		for (unsigned i = 0; i < count; ++i)
		{
			CCVector3 l = toLocalOrientation * (*m_associatedCloud->getPoint(i) - *G);

			*_A++ = 1.0;
			*_A++ = l.x;
			*_A++ = l.y;
			*_A = static_cast<double>(l.x)*l.y;  //###here is an error ,suppose to be *_A = static_cast<double>(l.x)*l.x;
			//by the way, we track the max 'X' squared dimension
			lmax2 = std::max(lmax2, *_A);

			++_A;
			*_A++ = static_cast<double>(l.x)*l.y;
			*_A = static_cast<double>(l.y)*l.y;
			//by the way, we track the max 'Y' squared dimension
			lmax2 = std::max(lmax2, *_A);
			++_A;

			*_b++ = l.z;
			//and don't forget to track the max 'Z' squared dimension as well
			lmax2 = std::max(lmax2, static_cast<double>(l.z)*l.z);
		}
	}

How to reproduce

Expected behaviour

Additional context

Your environment

  • CCCoreLib Version (or git hash/tag):
  • OS & Version:
  • Qt Version (if compiling w/Qt):
  • TBB Version (if compiling w/TBB):

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions