-
-
Notifications
You must be signed in to change notification settings - Fork 46.6k
ENH: two algorithms for the convex hull problem of a set of 2d points on a plain #1135
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
Conversation
maxwell-aladago
commented
Aug 17, 2019
- A naive brute-force algorithm
- A divide-and-conquer algorithm
return False | ||
|
||
def __repr__(self): | ||
return "({}, {})".format(self.x, self.y) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try this one with an f”string” and see if it is more concise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But f'strings' don't work with python 2 or?
Actually no, forgot to remove them before committing
… On 17 Aug 2019, at 10:29 AM, Christian Clauss ***@***.***> wrote:
@cclauss commented on this pull request.
In divide_and_conquer/convex_hull.py <#1135 (comment)>:
> + True
+ >>> Point(-0.5, 1) == Point(0.5, 1)
+ False
+ >>> Point("pi", "e")
+ Traceback (most recent call last):
+ ...
+ ValueError: x and y must be both numeric types but got <class 'str'>, <class 'str'> instead
+ """
+
+ def __init__(self, x, y):
+ if not (isinstance(x, Number) and isinstance(y, Number)):
+ try:
+ x, y = float(x), float(y)
+ except ValueError as e:
+ e.args = ("x and y must be both numeric types "
+ "but got {}, {} instead".format(str(type(x)), str(type(y))), )
Are the _str() calls required in this context?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#1135?email_source=notifications&email_token=ADXZYMTCWXIPRWTC3F4FAVTQFADOHA5CNFSM4IMPKTC2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCB3RE7I#pullrequestreview-276238973>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ADXZYMRF7TRFP2RMZGTCLRLQFADOHANCNFSM4IMPKTCQ>.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Impressive!
Thanks, I will make the suggested changes soon. |
… on a plain (TheAlgorithms#1135) * divide and conquer and brute force algorithms for array-inversions counting * divide and conquer and brute force algorithms for array-inversions counting * divide and conquer and brute force algorithms for array-inversions counting * a naive and divide-and-conquer algorithms for the convex-hull problem * two convex-hull algorithms, a divide-and-conquer and a naive algorithm * two convex-hull algorithms, a divide-and-conquer and a naive algorithm * two convex-hull algorithms, a divide-and-conquer and a naive algorithm