import numpy
import openGJK_cython as opengjk
if __name__ == "__main__":
vert_sphere_like = numpy.array(
[
[-0.58600003, 0.0, 1.0],
[0.0, -0.58600003, 1.0],
[0.58600003, 0.0, 1.0],
[0.0, 0.58600003, 1.0],
[1.0, 0.0, -0.70700002],
[1.0, 0.414, -0.414],
[1.0, 0.414, 0.414],
[1.0, 0.0, 0.70700002],
[1.0, -0.414, 0.414],
[1.0, -0.414, -0.414],
[0.0, 1.0, -0.70700002],
[-0.414, 1.0, -0.414],
[-0.414, 1.0, 0.414],
[0.0, 1.0, 0.70700002],
[0.414, 1.0, 0.414],
[0.414, 1.0, -0.414],
[-1.0, 0.0, -0.70700002],
[-1.0, -0.414, -0.414],
[-1.0, -0.414, 0.414],
[-1.0, 0.0, 0.70700002],
[-1.0, 0.414, 0.414],
[-1.0, 0.414, -0.414],
[0.0, -1.0, -0.70700002],
[0.414, -1.0, -0.414],
[0.414, -1.0, 0.414],
[0.0, -1.0, 0.70700002],
[-0.414, -1.0, 0.414],
[-0.414, -1.0, -0.414],
[0.0, 0.58600003, -1.0],
[0.58600003, 0.0, -1.0],
[0.0, -0.58600003, -1.0],
[-0.58600003, 0.0, -1.0],
],
dtype=numpy.float64,
)
vert_extruded_cube = numpy.array(
[
[-2.5, 0.0, 0.5],
[-3.5, 1.0, 0.5],
[-2.5, 0.0, -0.5],
[-3.5, 1.0, -0.5],
[0.0, 2.5, 0.5],
[0.0, 3.5, 0.5],
[-1.0, 3.5, 0.5],
[0.0, 2.5, -0.5],
[0.0, 3.5, -0.5],
[-1.0, 3.5, -0.5],
],
dtype=numpy.float64,
)
distance = opengjk.pygjk(vert_sphere_like, vert_extruded_cube)
print(distance)
The scene looks like the following screenshots ( two perspectives of same scene ):
My environment is MacOS Ventura 13.3.1 (22E261) arm64, Python 3.10.6, cpython build of openGJK ( master, commit 47df2d7 )