Open
Conversation
AGIS DANIELS EDITS I made this compressed version of the code from c++ and a python version on wikibooks toVec was moved to sub as toVec(a,b)== b-a tested this on 2 kattis problems my own version works on tested on 4 problems but it requires area and perimeter to work ccw and cross are almost the same in python as in c++ i added in a few things into the point class for it to solve the two convex hull problems on kattis that i tested on
Author
|
if you would like me to make a second branch and resubmit the pull request i will do so upon asking |
Owner
|
Ok just continue adding commits to this PR like this. Once a while (not every time you have updates), I will review and decide to merge or ask you to modify further. @seffendy is good with Python so he can also help comments on this PR. |
added 10 commits
July 30, 2020 06:53
Agis Daniels for consistency reasons i removed sub and re added vec ccw already used it in a difference file so i just used it from the points line .py as well < had a more elegant version from that file too so i used it here too retested and still holds ac on kattis
Agis Daniels nice one liner for area i called cross product function to avoid the need to retype the code again should help avoid typos when implementing it from paper the less than for point seems to work nicely with floats :) also added a oneliner version of the perimeter function above the code as well
Agis daniels
Agis Daniels they already existed in other files polyline.py is where i took these ones from also why is origin needed in the alt version of polygon area ??
Agis Daniels already existed in pointlines file so i just used the one from there
Agis Daniels the code i use in my own implementation is similar so i can just swap out my call with ccw as its similar to the c++ code :)
Agis Daniels im a bit iffy on insidePolygon as i tried to implment it before both like this and super mega compressed version and it had some errors for some reason the second loop had errors i mean will need to ask suhendry about it
Agis daniels good to go
Agis Daniels edit be sure to remove these two lines and set them to 0 in the __init__ function to my understanding those are class variables shared by all instances of the class as stated in this link https://docs.python.org/3/tutorial/classes.html#class-and-instance-variables
removed two lines
Author
|
good thing is this was the only part for python in this repo where i seen the bug |
added 3 commits
August 13, 2020 15:29
I coded up the rest of the functions while trying to stay true to the source code from c++ i ran into some bugs for CH_Graham scan which i need help understanding
Agis daniels
Author
|
got the file all implemented with respect to the c++ code provided however i need some help understanding the CH_Graham implementation as i had to switch a bit of code to make is work @seffendy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
My name is Agis Daniels and here are my edits
AGIS DANIELS EDITS
I made this compressed version of the code from c++ and a python version on wikibooks
toVec was moved to sub as toVec(a,b)== b-a
tested this on 2 kattis problems
my own version works on tested on 4 problems but it requires area and perimeter to work
ccw and cross are almost the same in python as in c++
i added in a few things into the point class for it to solve the two convex hull problems on kattis that i tested on