Closed bmbuncher closed 4 years ago
So this is not exposed in the public API (e.g. as indicated by the .pxd
module starting with an underscore). However, you can use it (for now), there is just no guarantee it'll be there in future releases.
The function is directly available in the bezier._speedup
module:
In [1]: import numpy as np
In [2]: import bezier._speedup
In [3]: nodes = np.asfortranarray([
...: [0.0, 1.0, 2.0],
...: [1.0, 0.0, 1.0],
...: ])
In [4]: bezier._speedup.evaluate_hodograph(0.75, nodes)
Out[4]:
array([[2.],
[1.]])
but there is no guarantee this module is present in a given install (e.g. if a user built from source and no Fortran compiler was present). The function is included in the bezier._curve_helpers
and falls back to a Python implementation if the Fortran speedup isn't present:
In [5]: import bezier._curve_helpers
In [6]: bezier._curve_helpers.evaluate_hodograph
Out[6]: <function bezier._speedup.evaluate_hodograph>
Aside: You've made me realize that I should provide a "public" version of all the methods in the libbezier
C API / ABI.
@bmbuncher I'm happy to re-open the issue if this hasn't solved your problem. I filed #140 to follow up on the whole C ABI / PXD / Python API confusion.
Hi! My apologies for the late response; it's been a crazy week! This did solve my issue, thank you so much! The issue was that I was using the wrong .pxd file.
Great to hear, cheers!
Would you consider revisiting this and making evaluate_hodograph public python API?
Sure thing, as always thanks for coming by @anntzer!
Hi! I am trying to use
evaluate_hodograph
in Python 3.6, but have been having some substantial difficulty with importing it. I have been through the documentation on binary extensions many times, but have been unable to figure this out.I have tried
cimport bezier._curve
(as described here: https://bezier.readthedocs.io/en/0.9.0/python/pxd/index.html), but this also failed due to a syntax error (I presume due to the fact that I'm using Python instead of Cython).In addition, I tried building from the source using
python3.6 setup.py build_ext
, which also did not work. This was equivalent to installing via pip.Do you know what the issue may be? I am using the Ubuntu Bash shell native to Windows 10; thus far, I have been treating the system as an Ubuntu system when performing installations, which has worked well, so I don't think I will need to deal with DLL files. If there is any other information I can provide, please let me know. Thank you!