adapt cython function defs to new namings
parent
cb2c3a4260
commit
c64ae900a3
|
@ -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)
|
||||||
|
|
|
@ -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):
|
||||||
|
|
|
@ -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")
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue