Algorithm help / Connecting Centroids
Posted: Sat Aug 26, 2017 9:51 pm
Hello and Greetings! New to this forum. My background is astronomy and computer programming.
I'm working on a PBD project and I'm trying to develop an algorithm to connect certain points with other points. What I've done is taken the PBD software from GitHub, and have modified the Demo example called 'GenericConstraintsDemos'. I've taken all contraints out except the distance constraint. I've also forced the simulation to work on a 2D plane with the intention of extending to 3D eventually.
Please refer to the following diagram:
So as you can see in this example, there are nine circles. The simulation allows for any number of circles, but I'm trying to make this post as simple as possible for starters. The green dots represent the centers of the circles; the red dots represent the centroids of the three adjacent/connected circles; the black dots represent some intersections (I call these the "outer" intersections) between circles; and the blue lines connect either centroids with other centroids, or centroids to intersections in a particular pattern. In the simulation, the radii of the circles can change and, since I'm applying a distance constraint, the varying sizes of the circles causes the locations (and existence) of the dots and lines to change.
The code that I have at this point is able to identify/calculate the locations of the black dots and the red dots, but I'm having trouble coming up with an algorithm that correctly connects the red and black dots. The diagram I've attached shows the correct connections, but coming up with an algorithm to do this automatically and as the simulation runs has me stumped.
I'll also add that each circle knows which other circles it's in contact with, and what those intersection points are.
Has anyone come across this problem and maybe give me some help?
Thank you and Cheers,
AstroCoder
I'm working on a PBD project and I'm trying to develop an algorithm to connect certain points with other points. What I've done is taken the PBD software from GitHub, and have modified the Demo example called 'GenericConstraintsDemos'. I've taken all contraints out except the distance constraint. I've also forced the simulation to work on a 2D plane with the intention of extending to 3D eventually.
Please refer to the following diagram:
So as you can see in this example, there are nine circles. The simulation allows for any number of circles, but I'm trying to make this post as simple as possible for starters. The green dots represent the centers of the circles; the red dots represent the centroids of the three adjacent/connected circles; the black dots represent some intersections (I call these the "outer" intersections) between circles; and the blue lines connect either centroids with other centroids, or centroids to intersections in a particular pattern. In the simulation, the radii of the circles can change and, since I'm applying a distance constraint, the varying sizes of the circles causes the locations (and existence) of the dots and lines to change.
The code that I have at this point is able to identify/calculate the locations of the black dots and the red dots, but I'm having trouble coming up with an algorithm that correctly connects the red and black dots. The diagram I've attached shows the correct connections, but coming up with an algorithm to do this automatically and as the simulation runs has me stumped.
I'll also add that each circle knows which other circles it's in contact with, and what those intersection points are.
Has anyone come across this problem and maybe give me some help?
Thank you and Cheers,
AstroCoder