numpy - finding cell coordinates between two points in meshgrid using python -
i have meshgrid
defined as:
from numpy import * x = arange(0,1107,1) y = arange(0,1129,1) xx,yy = meshgrid(x,y)
i trying coordinates of cells lying between 2 end cells. eg, coordinates of cells lying between (435, 550)
, (987, 980)
when these 2 points joined straight line. finding cell coordinates, through straight line passes. nice. in advance.
the problem trying solve equivalent drawing line in 2d array of pixels.
have @ this: http://en.wikipedia.org/wiki/line_drawing_algorithm , http://en.wikipedia.org/wiki/bresenham%27s_line_algorithm
you have precisely define mean "between", ie cell (x,y) included if line between xstart,ystart , xend,yend intersects rectangle (x,y,x+1,y+1). (or: want line @ xstart+0.5,ystart+0.5 etc?)
Comments
Post a Comment