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

added in CH_andrew #71

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

projectPythonator
Copy link

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

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
@projectPythonator
Copy link
Author

if you would like me to make a second branch and resubmit the pull request i will do so upon asking

@stevenhalim
Copy link
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.

projectPythonator 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
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 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
@projectPythonator
Copy link
Author

good thing is this was the only part for python in this repo where i seen the bug

projectPythonator 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
@projectPythonator
Copy link
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants