Please see attached image.
Given a TIN, and a point picked by user. How to find the triangle (three points) that contains the point? The result might be multiple triangles if the point is on one of the TIN lines. In this case, return any one of the triangles is ok.
No need to post code. Just the description of steps. I can think of an (very) ugly approach:
1. Start with a small polygon (6-sided or 8-sided) whose center if the point picked by user, make a CP selectionset using the polygon to see if it contains any of the TIN lines; if yes, go to step 2; if no, increase the polygon size, check again. Repeat until at least one TIN lines is selected;
2. Find the TIN line that is the closest to the polygon center. By "closest", I mean the perpendicular distance between the polygon center and the TIN line is the smallest;
3. At each end (Point A and B) of the TIN line (found in step 2), make a CP selectionset of TIN lines using a very small polygon; then find one TIN line from each of these two selectionsets that shares a common vertex (Point C).
Point A, B and C would be the triangle (or one of the triangles) that contains the point.
Thanks.