Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # plot_points_a2b.py
- # from point A to point B
- import math
- def div(a,b):
- try: return a / b
- except: return 0
- def plot(incr=25):
- x,y=[aX-bX,aY-bY]
- L=div(max(abs(x),abs(y)),incr*1.0)
- x,y=div(x,L)*-1,div(y,L)*-1
- for z in range(0,int(L)+1):
- print aX+(x*z), aY+(y*z)
- print
- aX,aY=[600,640]
- bX,bY=[1000,920]
- plot()
- aX,aY=[1000,640]
- bX,bY=[600,920]
- plot()
- aX,aY=[600,920]
- bX,bY=[1000,640]
- plot()
- aX,aY=[1000,920]
- bX,bY=[600,640]
- plot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement