ConvexBodyProximityQueries False Collision Detection and Proximity

I have been using the package ConvexBodyProximityQueries and I cannot find the reason why it fails to calculate the distance between the following 3D Triangles.
If I reverse the arguments order, 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)

Output:

julia> dist1
0.0f0

julia> dist2
1.7844534f0

I am not familiar with this specific software package. Since nobody else provided any comments so far, I will try to provide my “wisdom” :wink:

This works with identical coordinates.

using StaticArrays
using ConvexBodyProximityQueries

p = SMatrix{3,3}(reshape([-0.37579435f0, 0.014414025f0, 0.3265663f0,
                          -0.37263185f0, 0.0108978925f0, 0.36118037f0,
                          -0.35647663f0, 0.03625821f0, 0.34328437f0], 3,3))

q  = SMatrix{3,3}(reshape([0.23884095f0, -1.6477574f0, 0.116889484f0,
                           0.26891768f0, -1.6353351f0, 0.10821109f0,
                           0.26338503f0, -1.6657706f0, 0.10510237f0], 3,3))

dir = @SVector(rand(Float32,3)) .- 0.5f0

dist1 = minimum_distance(p, q, dir)
dist2 = minimum_distance(q, p, dir)

dist1 ≈ dist2

Thank you for the reply professor,

This does not solve my issue.
I am calling this routine to calculate distances for hundreds or thousand of times.
If any of these routine calls fails, then the whole result is wrong.

Unfortunately, this is not rare to happen, I can reproduce it almost always.
I thought that , theoretically, the GJK algorithm always converges regardless of the choice on the initial direction.