ConvexBodyProximityQueries.jl icon indicating copy to clipboard operation
ConvexBodyProximityQueries.jl copied to clipboard

Wrong Results on this testcase

Open karelispanagiotis opened this issue 1 year ago • 0 comments

I have been using this package for distance calculation between 3D Triangles. I cannot understand why the case fails (I can provide more if anybody requests). Example code, where I get a collision, when clearly there isn't any. If I rearrange the arguments of minimum_distance(), I get the correct answer.

using Meshes
using StaticArrays
using ConvexBodyProximityQueries

t1 = Triangle(Point(-0.37579435f0, 0.014414025f0, 0.3265663f0),
              Point(-0.37263185f0, 0.0108978925f0, 0.36118037f0),
              Point(-0.35647663f0, 0.03625821f0, 0.34328437f0));

t2 = Triangle(Point(0.23884095f0, -1.6477574f0, 0.116889484f0),
              Point(0.26891768f0, -1.6353351f0, 0.10821109f0),
              Point(0.26338503f0, -1.6657706f0, 0.10510237f0));
p = StaticArrays.sacollect(SMatrix{3, 3}, x for v in t1.vertices for x in v.coords);
q = StaticArrays.sacollect(SMatrix{3, 3}, x for v in t2.vertices for x in v.coords);

dir = centroid(t2) - centroid(t1);
dist1 = minimum_distance(p, q, dir)
dist2 = minimum_distance(q, p, dir)

And the output is:

julia> dist1
0.0f0

julia> dist2
1.7844534f0

karelispanagiotis avatar Oct 04 '22 19:10 karelispanagiotis