Abstract example to illustrate my problem/question:
one list of points (in a grid)
one list of meshes (in a grid)
For each point check all meshes in the list for their closest point, ignoring the mesh that has the same index as the current point.
The second part of the sentence is the problem - how to ignore the current index in a different list?
In code it is simple:
for(int i = 0; i < points.Count; i++) {
for(int j = 0; j < meshes.Count; j++) {
if(i != j) {
// do some work
}
}
}
but how to do this without code? The setup described here is quite abstract, but it is an everyday task in programming to loop lists while ignoring âitselfâ - all kinds of neighborhood problems require this functionalityâŚ
Why without code - some examples i want to show students, but without requiring them to codeâŚ
Note though that, if the points are ordered differently than the meshes, meaning that each mesh doesnât correspond to its closest point in the first place, the ignored indices wonât be those of closest points on closest meshes.
However, reading your description above that wasnât what you asked for either.
As a teacher, you should have known better and provided a file.
You are helping them to become unemployed sooner or later eh? he, he.
Jokes apart using a bool Array (say: bool[,] visited = new bool[list1.Count, list2.Count]) ⌠or a custom Class is the orthodox way to go. If fact a Class is far superior since allows you to use LINQ queries that extend by far the filtering capabilities (other than the âis that youâ [i != j] ?) .
For instance imagine that we have N polylines that either are connected (some node in this poly with some node on that poly) or they are apart. How to close the gaps? (within a search Interval [tol, searchRange]) How to monitor whatâs happened in the double loop required? That sort of stuff is easily addressed via a Class (in this case stuff that monitors Pairs).