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...
- Use a NeighborFinder to find the nearest point within your minimum separation distance. This will give you closest candidate x and y coordinates.
- Use a CoordinateExtractor to get the x and y coordinates of your current point
- Create a line from (current x, closest candidate y) to (current x, current y)
- Extend that line the required distance (your minimum distance minus its current length)
- 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.