[Tutor] How to count vehicle? I'm trying but my code don't increasing..

Alan Gauld alan.gauld at btinternet.com
Tue Sep 2 19:19:20 CEST 2014


On 02/09/14 15:01, Whees Northbee wrote:
> If all of these confusing, I'll simplify the problem, I need to know
> if a point (x,y) exactly at a line where line is (ax1,ay) to
> (ax2,ay)..
>
> Can someone tell me how??

Take the equation of the line and see if x,y fits.

The hard bit is that if you are sampling x.y periodically you may never 
get the points exactly on the line so you may need to settle for 
determining whether the point crossed the line. That will require that 
you store the previous coordinates and compare to the new ones to see if 
they cross ay within the given ax boundaries.


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos



More information about the Tutor mailing list