Skip to main content

I would like to increase the distance between groups of points, like what you see below. I have them "grouped" by common attribute so figuring out who belongs is taken care of. But I have not figured out how to get their position in relation to each other. The one in the middle is to stay put while the one on top moves up, and the one below moves down. How can I figure out which one is the "upper" and which one is the "bottomer"? This is necessary in order to move them in the right direction. I only want to move them in the Y direction. Also please note that there are 3 points in this example, but I also have some groups with only 2 members.

I was thinking maybe I could use a CoordinateExtractor to get the Y values for all members in the group. But then I get stuck what to do next? My guess is that it could be solved with a TestFilter and some wizardry in the Artimetric Editor, but I don't know how.

In the final step I plan to use the VertexCreator to set the new position.

 

You could try using the Displacer for that. It looks like it'll work if you put everything in as both Base and Candidate features.


You could try using the Displacer for that. It looks like it'll work if you put everything in as both Base and Candidate features.

Thanks! I could not get this do do what I need though. The transformer seems to bump objects in two dimensions, I only want them to move along Y. Also feeding everything into it caused all the "singles" to also move the minimum distance.


Thanks! I could not get this do do what I need though. The transformer seems to bump objects in two dimensions, I only want them to move along Y. Also feeding everything into it caused all the "singles" to also move the minimum distance.

Okay, this is where it gets a bit more convoluted...

  1. Use a NeighborFinder to find the nearest point within your minimum separation distance. This will give you closest candidate x and y coordinates.
  2. Use a CoordinateExtractor to get the x and y coordinates of your current point
  3. Create a line from (current x, closest candidate y) to (current x, current y)
  4. Extend that line the required distance (your minimum distance minus its current length)
  5. Snap your point to the end of that line

This does not account for potentially putting the point too close to another one though...


You also have the custom transformer CoincidentPointOffsetter. It can move points that are too close to each others (iteratively as well, and in X, Y or both directions), but I don't think you can control which point that will stay put though.


@aron I think you can solve this using just your original method along the lines of CoordinateExtractor and VertexCreator (but substituting Offsetter as a slightly simpler form)

The only thing you are missing is Sorter to sort by the Y Coordinate, and Counter to give a "Point 1, Point 2, Point 3" attribute within each group of three points. This gives you granular control then over making sure that each specific point in a list of 3 points gets processed in a particular way. Then it becomes pretty trivial to adjust Point 1 by a positive (upwards) Y increment, and adjust Point 3 by a negative (downwards) Y increment, and leave Point 2 alone. The only "trick" with Counter is to use the Group ID as the "Counter Name" which means it will reset to 1 once it gets to a new group of points.

Here I've just shortened it a little bit using Offsetter instead of VertexCreator, and a minimum Y separation distance of 5.5 above the mid point for the "upper" point, and 5.5 below the mid point for the "lower" point.

If it was me I would probably generalise the solution using equivalent Lists grouped around the GroupID attribute instead, which would allow me to handle any number of points in a group, but in the case of where you just want to process groups of 3 points and there are no groups with more than 3 points......this works:


@aron I think you can solve this using just your original method along the lines of CoordinateExtractor and VertexCreator (but substituting Offsetter as a slightly simpler form)

The only thing you are missing is Sorter to sort by the Y Coordinate, and Counter to give a "Point 1, Point 2, Point 3" attribute within each group of three points. This gives you granular control then over making sure that each specific point in a list of 3 points gets processed in a particular way. Then it becomes pretty trivial to adjust Point 1 by a positive (upwards) Y increment, and adjust Point 3 by a negative (downwards) Y increment, and leave Point 2 alone. The only "trick" with Counter is to use the Group ID as the "Counter Name" which means it will reset to 1 once it gets to a new group of points.

Here I've just shortened it a little bit using Offsetter instead of VertexCreator, and a minimum Y separation distance of 5.5 above the mid point for the "upper" point, and 5.5 below the mid point for the "lower" point.

If it was me I would probably generalise the solution using equivalent Lists grouped around the GroupID attribute instead, which would allow me to handle any number of points in a group, but in the case of where you just want to process groups of 3 points and there are no groups with more than 3 points......this works:

Thanks @bwn! This looks like it would do the trick! I will try it out.


Reply