Data Modle: Detect a point if it's inside a nodes-map
1- Search all triangles in the nodes-map
[Algorithm 1]
s0 - Start.
s1- Let point P(i) = (x(i), y(i)), points set {P(i)};
Let line L(i) = (P(i), P(i+1)), lines set {L(i)};
Let triangle T(i) = (P(i), P(i+1), P(i+2)), triangle set {T(i)};
s2- Find Min(y) in {P(i)}, if find P(k), goto s6;
s3- Find Max(y) in {P(i)}, if find P(k), goto s6;
s4- Find Min(x) in {P(i)}, if find P(k), goto s6;
s5- Find Max(x) in {P(i)}, if find P(k), goto s6;
s6- Let T(k-1) = (P(k-1), P(k), P(k+1)), k > = 2,
Let points set {P(h)}, not includes P(k-1), P(k) and P(k+1),
If there is a P(h) in T(k-1), goto s3 or s4 or s5;
Find a triangle T(k-1),
If only 3 points in {P(i)} = (P(k-1), P(k), P(k+1)), goto s7;
Delete P(k) from {P(i)},
Delete L(k-1), L(k) from {L(i)},
Add L(k-1) = (P(k-1), P(k+1)) into {L(i)},
goto s2;
s7- End;
2- Detect a point if it's inside a triangle of the nodes-map
BR,
Mars
June 22, 2013
If you want to discuss with me for this article, please feel free to
E-me: mars.fu@foxmail.com.