I will try to provide the best description as possible, an image is included:
I have multiple blocks laid out in a pattern, that can vary. I need to draw a leader to connect them. The number of blocks included in one leader is determined by the user. In the example image, 12 is the number required.
Logic: Best to try and link block horizontally, with the minimum number of vertical connections, but the goal is not to have large gaps between blocks.
I am hoping for some direction, Thank you
I think your first step is to group all blocks that are directly adjacent to each other in either horizontal or vertical direction into groups. Call these groups "blobs". In brute force this means comparing each block to all other blocks and then adding the passing blocks into the blob group and then performing the same process on that added block. You start a new blob group once you have exhausted all the trys. So I would start putting all "unblobbed" blocks into a collection. There might be some value to sorting by coordinates this ungrouped collection prior to starting the group creation process. That might streamline the comparison process. So in the blobbing process decribed above you are picking out of the unblobbed collection. This collection dimishes to nothing by the end of this intial blobbing process. The next step must be something like where you categorize the blobs by how far away they are from each other. You would use that information to decide which blobs to connect across if you need to. But I am not sure what the best approach would be. It might be that you treat all blob collections that have a count that is a multiple of the "leader connection number" separately since each of these can be leader connected with no gaps. That would leave all the odd blob collections to be treated by how far they are away from each other, but there is the chance that two odd blob collections sandwich a self contained blob collection where the gap distance might be less if all three were connected. So I'm stumped.
Access a broad range of knowledge to help get the most out of your products and services.
Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.
Upgrading to a 2015 product? Make sure to check these out 1st!