Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to fit normally #8

Open
KAL-AL opened this issue Aug 1, 2022 · 2 comments
Open

Unable to fit normally #8

KAL-AL opened this issue Aug 1, 2022 · 2 comments

Comments

@KAL-AL
Copy link

KAL-AL commented Aug 1, 2022

Thank you very much for your work
I want to iterate out a transformation matrix And with this matrix I can fit the points on a known plane,My constraint is the distance from the point to the plane。But I didn't get the right results 。Can you help me see if the usage is correct

image
image
image
image

@Rookfighter
Copy link
Owner

Hi @KAL-AL,

thanks for using least-squares-cpp! So telling from your Objective functor, you should rotate and translate the Points using your translation vector and rotation matrix before you project them on the plane.
So inside your loop you should do something along these lines:

Eigen::Vector3d transformedPoint = rotation * Points->at(i) + translation;
fval(i) = std::abs(Plane->A * transformedPoint(0) + Plane->B * transformedPoint(1) + Plane->C * transformedPoint(2) + Plane->D);

I am assuming that A, B and C define the normal of the plane and D is the offset of the plane from the origin along its normal.
Does that do the trick for you?

@Rookfighter
Copy link
Owner

@KAL-AL Any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants