-
Notifications
You must be signed in to change notification settings - Fork 101
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
Normal and nearest points uniformization #329
Normal and nearest points uniformization #329
Conversation
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.
The PR seems good to me.
I suggest creating a new branch called hppfcl3x, as the modifications imply a break in the API.
The CI is failing because I didn't serialize the |
The CI is also failing because #327. Can you rebase this on devel ? |
This is a test to see if documentation can appear in a commit.
Co-authored-by: Justin Carpentier <justin.carpentier@inria.fr>
4d53b5d
to
169b700
Compare
hppfcl3x is behind devel, so you can fast-forward by just pushing there. I think you should have the right for this. Can you check this ? |
Yes, I do have the right, thanks! |
@lmontaut : Thank you for this valuable work. I did not look into all the modifications. Can you confirm that after calling |
Hi @florent-lamiraux, yes A bit more details: the changes I made is to add the |
Great. Thank you. |
This PR addresses #307.
In short:
The library is made uniform w.r.t the definition of the witness points (in hppfcl they are called
nearest_points
, we might want to change that to avoid confusion) and the normal.In details:
Depending on which collision pair between two objects
o1
ando2
, there were concurrent definitions of their normal and their witness points. The reason is that GJK and EPA were rewritten in hppfcl but followed a different convention compared to the original fcl library when it comes to the definition of the normal.Thus, collision pairs involving specialized functions (not using GJK+EPA) were behaving differently than GJK+EPA.
In addition, the specialized functions returned collocated witness points whereas GJK+EPA returned the true witness points.
To address this, this PR does the following:
o1
too2
. It follows that the distanced(o1, o2)
between the shapes is always a signed distance (even when usingcollide
, contrary to current behavior): it is negative when collision, positive otherwise. The normaln
and the witness pointsp1
andp2
are related in that the normal always points in the direction of the separation vector:separation_vector = sign(d(o1, o2)) * (p2 - p1) and
n = separation_vector.normalized(). The separation vector can be used to bring the shapes into touching contact (share at least a contact point bu zero intersection volume). Indeed, if we translate
o1by
separation_vector`, regardless of collision or not, we bring the shapes into touching contact.o1
according to the separation vector and makes sure that the shapes are in collision if they were not or not in collision if they were.This PR is long, apologies for that. I think that the most important is to understand and agree on the definition of the normal given above. I sticked to the existing documentation, i'm happy to update it if everyone agrees on a different definition of the normal. The other important thing is to understand the test I added,
test/normal_and_nearest_points.cpp
, which guarantees all collision pairs follow the same definition.All of this corresponds to the first 9 commits of the PR, the rest is simply updating each specialized function.