2015-05-19 26 views

回答

0

這似乎更到的溶液是一種數學問題的:

經過測試線和陣列:

test_point=(x,y); 
for each line (x1,y1),(x2,y2) in the array of lines{ 
    if(x1<x&x<x2&y1<y&y<y2)&& 
    ((x-x1)/(y-y2)~=(x-x2)/(y-y2))) the point lies in the given line 
} 

基本上,確保點X1 < = X < = X2 (x1,y1)到(x,y)和(x,y)到(x2,y2)的斜率近似相等。

相關問題