Skip to content

Instantly share code, notes, and snippets.

@huydx
Created June 23, 2013 06:20
Show Gist options
  • Save huydx/5844017 to your computer and use it in GitHub Desktop.
Save huydx/5844017 to your computer and use it in GitHub Desktop.
get_linefunc.py
def get_linefunc(self, start_p, end_p): #just for 2nd euclidian space
x1, y1 = start_p[0], start_p[1]
x2, y2 = end_p[0], end_p[1]
a = 0 if ((x2-x1) == 0) else (y2-y1)/(x2-x1)
b = -1
c = x1*a - y1
return {'a':a, 'b':b, 'c':c}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment