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

Add convexhull to convehull test #334

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Levi-Armstrong
Copy link
Contributor

@Levi-Armstrong Levi-Armstrong commented Sep 7, 2018

This test triggers the assert for isOutsidePolytopeFace in ComputeVisiblePatch


This change is Reviewable

@Levi-Armstrong
Copy link
Contributor Author

This is to assist with issue #326 testing

@Levi-Armstrong
Copy link
Contributor Author

Here is th ply files if you want to view the convex hull for commit ab76114
link_7_0.ply.txt
sphere_link_0.ply.txt

@hongkai-dai
Copy link
Contributor

Hi Levi,

Thanks a lot for the PR! I think we can fix the problem in that assert with LIBCCD solver. I will file a PR with part of your test to expose the problem.

@Levi-Armstrong
Copy link
Contributor Author

I have added second of three tests which triggers another assert.

@hongkai-dai
Copy link
Contributor

Hi Levi,

I believe #336 should fix the problem convexhull_convexhull_ccd.

convexhull_convexhull_indep calls a totally different code path. It uses FCL's independent solver with collide function. It incorrectly returns a negative value as the penetration depth. I do not think I can quickly fix that code (I didn't touch collide function or indep solver before). Would you mind to comment out convexhull_convexhull_indep test, and add a TODO in the documentation, saying that we will fix this test later?

I will look into the box_cylinder_test. It triggers !triangle_area_is_zero(a, b, c) assert in faceNormalPointingOutward. This is likely a degenerate case. @SeanCurtis-TRI

Best,
Hongkai

@Levi-Armstrong
Copy link
Contributor Author

Levi-Armstrong commented Sep 14, 2018

@hongkai-dai I commented out the one test. I also added another test for different scenarios related to checking two convex hulls. Looking at the results of the test it has some large errors when two objects are in collision for distance and nearest points. The following case are currently tested for when the closest feature is:

  • Edge to Edge
  • Vertex to Vertex

Need to add:

  • Edge to Vertex
  • Edge to Face
  • Vertex to Face
  • Face to Face

@sherm1
Copy link
Member

sherm1 commented Sep 14, 2018

/cc @DamrongGuoy

@hongkai-dai
Copy link
Contributor

hongkai-dai commented Sep 20, 2018

Hi Levi,

Sorry for my belated reply.

I am looking into your test in https://github.com/Levi-Armstrong/fcl/blob/convexTests/test/test_fcl_convexhull_convexhull.cpp#L542L546. May I ask how you obtain these numbers -0.27552, 0.23776, -0.03776?

In your comment https://github.com/Levi-Armstrong/fcl/blob/convexTests/test/test_fcl_convexhull_convexhull.cpp#L529, you mentioned that the closest feature between the two colliding objects are edge to edge. I think mathematically it is proved that the closest point on the boundary of the Minkowski difference A ⊖ B is an interior point within each facet (see theorem 4.8 of https://github.com/tianxiao/Recent-Advances-in-Real-Time-Collision-and-Proximity-Computations-for-Games-and-Simulations-/blob/master/books/Collision%20Detection%20in%20Interactive%203D%20Environments.pdf). Namely if your polytope is well posed (no two neighbouring faces are parallel), then the closest feature can never be edge to edge, at least one of the feature should be a face.

@hongkai-dai
Copy link
Contributor

Hi Levi,

Sean @SeanCurtis-TRI and I looked into your test on the closest distance. We think in https://github.com/Levi-Armstrong/fcl/blob/convexTests/test/test_fcl_convexhull_convexhull.cpp#L542L546, what you find is not the penetration depth, but the distance between two edges.

The definition of the penetration depth is
min |v|
s.t (A + v) ∩ B = ∅

Namely the penetration depth is the minimal translational distance, such that the two objects A and B can get out of contact. While the distance you find can get the two objects out of contact, it is not the minimal one.

To show the minimal translation distance, Sean draws the two polytopes as
spheres_dense_colliding

We draw the two closest points p1, p2 found from EPA
sphere_transparent_colliding

And we translate one sphere with a vector p1 - p2, here are the translated spheres. You can see that they are separated
spheres_dense_separating

The distance found from EPA is 0.2706222, smaller than the distance you computed (0.27552). So by definition of penetration depth, the EPA distance is more correct than 0.27552.

Note that the closest points found from EPA are not on the edges, and the vector p1 - p2 is not along the x axis.

@sherm1
Copy link
Member

sherm1 commented Sep 20, 2018

Wow! That is an awesome issue comment.

@Levi-Armstrong
Copy link
Contributor Author

@hongkai-dai and @SeanCurtis-TRI This is great and thank you for the detailed response. I came up with the number using blender and physically measuring two meshes. The one difference is I was measuring along the the same translation vector provided by using primitive shapes assume they should be same. As you pointed out this will not be the same so bad assumption on my part. I will revise the test with the correct information.

@Levi-Armstrong
Copy link
Contributor Author

@hongkai-dai and @SeanCurtis-TRI This is great and thank you for the detailed response. I came up with the number using blender and physically measuring two meshes. The one difference is I was measuring along the the same translation vector provided by using primitive shapes assume they should be same. As you pointed out this will not be the same so bad assumption on my part. I will keep looking.

@Levi-Armstrong
Copy link
Contributor Author

So I pulled the meshes into blender and transformed one mesh 0.2m in the x direction. Then created a line between the nearest points(Provided by FCL) to understand where it was on the mesh. Based on your description it sounds like the closest objects should not be two edges but when visualizing it looks like they are both on an edge. Although they could be just very close to the edge but it just looked suspicious. I am going to calculate how close it is and post the results.

Point: -0.025420749082411945, -0.06229177389074456, -0.025420749082411945
image

Point: -0.032902129264164116, -0.06229177389074456, 0.025420749082411945
image

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

Successfully merging this pull request may close these issues.

3 participants