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 # Declare C function and data types
cdef extern from "openGJK.h": cdef extern from "openGJK.h":
struct bd: struct gkPolytope_:
int numpoints int numpoints
double s[3] double s[3]
double ** coord double ** coord
struct simplex: struct gkSimplex_:
int nvrtx int nvrtx
double vrtx[4][3] double vrtx[4][3]
int wids[4] int wids[4]
double lambdas[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 # cython: language_level=3
# distutils: sources = ../../src/openGJK.c # distutils: sources = ../../openGJK.c
# distutils: include_dirs = ../../include/openGJK # distutils: include_dirs = ../../include/openGJK
cimport openGJK_cython cimport openGJK_cython
@ -44,9 +44,9 @@ def pygjk(bod1, bod2):
# Declare data types # Declare data types
cdef: cdef:
simplex s gkSimplex_ s
bd bd1 gkPolytope_ bd1
bd bd2 gkPolytope_ bd2
double dist2 double dist2
# Convert 1D array to 2D, if any # Convert 1D array to 2D, if any
@ -96,7 +96,7 @@ def pygjk(bod1, bod2):
bd2.coord[i][j] = narr2[i,j] bd2.coord[i][j] = narr2[i,j]
# Call C function # Call C function
dist2 = gjk(bd1, bd2, &s) dist2 = compute_minimum_distance(bd1, bd2, &s)
# Free the memory # Free the memory
for ii in range(0, bd1.numpoints): for ii in range(0, bd1.numpoints):

View File

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