Merge pull request #28 from harmening/fix-cython

Fix cython - thanks to @harmening
fixes-turtlebasket
Mattia Montanari 2022-09-29 14:11:05 +02:00 committed by GitHub
commit 3ac54fa3ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 10 deletions

View File

@ -30,15 +30,15 @@
# Declare C function and data types
cdef extern from "openGJK.h":
struct bd:
struct gkPolytope_:
int numpoints
double s[3]
double ** coord
struct simplex:
struct gkSimplex_:
int nvrtx
double vrtx[4][3]
int wids[4]
double lambdas[4]
double gjk(bd bd1, bd bd2, simplex *s)
double compute_minimum_distance(gkPolytope_ bd1, gkPolytope_ bd2, gkSimplex_ *s)

View File

@ -30,7 +30,7 @@
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# cython: language_level=3
# distutils: sources = ../../src/openGJK.c
# distutils: sources = ../../openGJK.c
# distutils: include_dirs = ../../include/openGJK
cimport openGJK_cython
@ -44,9 +44,9 @@ def pygjk(bod1, bod2):
# Declare data types
cdef:
simplex s
bd bd1
bd bd2
gkSimplex_ s
gkPolytope_ bd1
gkPolytope_ bd2
double dist2
# Convert 1D array to 2D, if any
@ -96,7 +96,7 @@ def pygjk(bod1, bod2):
bd2.coord[i][j] = narr2[i,j]
# Call C function
dist2 = gjk(bd1, bd2, &s)
dist2 = compute_minimum_distance(bd1, bd2, &s)
# Free the memory
for ii in range(0, bd1.numpoints):

View File

@ -40,5 +40,5 @@ exts = Extension(
setup(
name='openGJK-cython-version',
ext_modules = cythonize( [exts] )
ext_modules = cythonize([exts], language_level = "3")
)