Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating error message for locate() methods. #36

Merged
merged 1 commit into from
Jul 17, 2017
Merged

Conversation

dhermes
Copy link
Owner

@dhermes dhermes commented Jul 17, 2017

Also adding a note that locate() / evaluate*() are (essentially) inverses.

See #35 for context.

/cc @pdknsk

Old error:

>>> import numpy as np
>>> import bezier
>>> curve = bezier.Curve.from_nodes(np.asfortranarray([
...     [0.0, 0.0],
...     [0.5, 0.0],
...     [0.5, 1.0],
...     [1.0, 1.0],
... ]), _copy=False)
>>> curve.evaluate(0.5)
array([[ 0.5,  0.5]])
>>> curve.locate(np.asfortranarray([[0.5]]))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../bezier/curve.py", line 898, in locate
    point, 'Shape expected:', (1, self._dimension))
ValueError: ('Point is not in same dimension as curve', array([[ 0.5]]), 
             'Shape expected:', (1, 2))

New error:

>>> curve.locate(np.asfortranarray([[0.5]]))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../bezier/curve.py", line 908, in locate
    raise ValueError(msg)
ValueError: Dimension mismatch: This curve is 2-dimensional, so the point should be
            a 1x2 NumPy array. Instead the point [[ 0.5]] has dimensions 1 x 1.

Also adding a note that `locate()` / `evaluate*()` are
(essentially) inverses.

See #35 for context.
@dhermes dhermes added the docs label Jul 17, 2017
@dhermes dhermes self-assigned this Jul 17, 2017
@dhermes dhermes mentioned this pull request Jul 17, 2017
@dhermes dhermes merged commit eaa4a5a into master Jul 17, 2017
@dhermes dhermes deleted the issue-35-doc-update branch July 17, 2017 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant