In the program I am working on, we analyze the data of MRI scans. Sometimes, we want to draw boundaries around certain vessels in the brain.

When creating an object boundary around two different vessels, it is normal to use two different objects.

However, sometimes the second boundary is created under the same object name. This means that there are two separate boundaries that are technically just one object.

I am trying to make a function that removes a region from one object, because currently the only option is to delete the object as a whole.

The boundary is stored as a CList of CPoints, and these points only contain the actual boundary, not the points within the boundary. Here is an example output of the boundary points relative to the mouse:

x: 269 y: 217 mouse: 234 217
x: 260 y: 215 mouse: 234 217
x: 261 y: 214 mouse: 234 217
x: 262 y: 213 mouse: 234 217
x: 263 y: 212 mouse: 234 217
x: 265 y: 212 mouse: 234 217
x: 266 y: 213 mouse: 234 217
x: 267 y: 214 mouse: 234 217
x: 268 y: 215 mouse: 234 217
x: 260 y: 214 mouse: 234 217
x: 261 y: 213 mouse: 234 217
x: 262 y: 212 mouse: 234 217
x: 266 y: 212 mouse: 234 217
x: 267 y: 213 mouse: 234 217
x: 230 y: 213 mouse: 234 217
x: 229 y: 212 mouse: 234 217
x: 229 y: 213 mouse: 234 217
x: 229 y: 214 mouse: 234 217
x: 230 y: 212 mouse: 234 217
x: 230 y: 214 mouse: 234 217
x: 231 y: 212 mouse: 234 217
x: 231 y: 213 mouse: 234 217
x: 231 y: 214 mouse: 234 217
x: 230 y: 211 mouse: 234 217
x: 232 y: 213 mouse: 234 217
x: 229 y: 211 mouse: 234 217

As you can see, about half way through, the points in the X column change drastically from 267 to 230. So, with a difference of over 35, it is obvious where the two regions could be separated.

However, it is not always that easy. If the two regions are extremely close together, then the differences between the X and Y points would be almost impossible to differentiate between one region and another.

As you can see at the top of the list of points, the X variable changes by a factor of 9 units, even though it is still a part of the same region. So if I had a second region less than 9 units away, then it would be seemingly impossible to tell the difference.

Any ideas?