-
Notifications
You must be signed in to change notification settings - Fork 67
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
Add eigen utils to convert mesh 3d vertices to oriented box #224
Conversation
Signed-off-by: AmrElsersy <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you've resolved a lot of comments but I don't see the corresponding changes in the code
Signed-off-by: AmrElsersy <[email protected]>
forgot to push :D |
Signed-off-by: AmrElsersy <[email protected]>
Codecov Report
@@ Coverage Diff @@
## ign-math6 #224 +/- ##
==========================================
Coverage 99.21% 99.22%
==========================================
Files 65 66 +1
Lines 6089 6162 +73
==========================================
+ Hits 6041 6114 +73
Misses 48 48
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, this looks good. I'm trying to do a few verifications for testing, but I think that this can be merged as long as I don't find anything strange in the tests I run.
Signed-off-by: AmrElsersy <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made a few suggestions about documentation and naming, suggesting vertices instead of mesh to avoid confusion with ignition::common::Mesh
Signed-off-by: AmrElsersy <[email protected]>
Signed-off-by: AmrElsersy <[email protected]>
This pull request has been mentioned on Gazebo Community. There might be relevant details there: https://community.gazebosim.org/t/gsoc-2021-machine-learning-extension-to-ignition-gazebo/1070/1 |
I went ahead and ran the example set of points in the unit test through Open3D's
It looks like the box's center and size are similar enough between |
@adlarkin their code Eigen::Matrix3d R = es.eigenvectors();
R.col(0) /= R.col(0).norm();
R.col(1) /= R.col(1).norm();
R.col(2) /= R.col(2).norm();
if (evals(1) > evals(0)) {
std::swap(evals(1), evals(0));
Eigen::Vector3d tmp = R.col(1);
R.col(1) = R.col(0);
R.col(0) = tmp;
}
if (evals(2) > evals(0)) {
std::swap(evals(2), evals(0));
Eigen::Vector3d tmp = R.col(2);
R.col(2) = R.col(0);
R.col(0) = tmp;
}
if (evals(2) > evals(1)) {
std::swap(evals(2), evals(1));
Eigen::Vector3d tmp = R.col(2);
R.col(2) = R.col(1);
R.col(1) = tmp;
} But anyway I see them are close (not too much close) but they have rotation in the same directions at least .. and also the rotation is acceptable visually, so we don't need to compare it with Open3D |
Signed-off-by: AmrElsersy <[email protected]>
Signed-off-by: AmrElsersy <[email protected]>
That was the output when I tried that code of Open3D for calculating Rotation instead of the current algorithm |
Signed-off-by: AmrElsersy <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few small comments, but I think this is almost ready to merge!
have we considered specifying the orientation of the bounding box and then simply expanding its dimensions to include all the passed vertices? this would avoid the weird box rotations at the cost of generating non-minimal boxes |
I think the challenge is that in some scenarios, we have the vertices of an object, but not the orientation of the object. For example, in gazebosim/gz-rendering#334, I believe that we have all of the vertices from the bounding boxes provided by Ogre, but I don't believe that we have a way of getting the "combined orientation" from all of the rendering visuals (I could be wrong about this). However, that being said, I think that it would be good to provide users with the option to pass in an orientation to |
Signed-off-by: AmrElsersy <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good! I'm going to wait to see what @scpeters thinks about #224 (comment) before merging this.
I would just add a separate API that accepts a vector of vertices as well as a |
Signed-off-by: Steve Peters <[email protected]>
Signed-off-by: AmrElsersy [email protected]
🎉 New feature
Summary
Adding helper functions to convert 3d vertices of a mesh to an oriented bounding box to be used in the bounding box camera
rendering#334
Checklist
codecheck
passed (See contributing)