Make dla with circles instead of pixels

Hi everyone I have a code for 2D DLA but it adds pixels to an initial pixel and I would like them to not be pixels but small squares or small circles instead. I have managed to make the initial area to which the pixels from the dla are added a square or a circle but I cant find a way to add circles or other squares to it.

 Risposta accettata

William Rose
William Rose il 6 Feb 2023
Here is a script that does what I think you are requesting. Each monomer in the aggregate is represented by a circle. I will use 3 figures to illustrate this:
Above: Possible circles to use for each monomer, ranging from diameter d=6 pixels to d=20 pixels.
Above: Aggregate array with d=10. Inset: original aggregate, 1 pixel per monomer.
Above: Aggregate array with d=20. Inset: original aggregate, 1 pixel per monomer.
I think the image with d=10 is just as good as the one with d=20, so I recommend it, since it takes up 4 times less memory than the image with d=20. You can change d in the script, run it, and decide.

8 Commenti

Thank you@William Rose this is awesome!
@William Rose do you know if there is a way for the pixels that are closer to center of the aggregate to be bigger than the ones that are further from the center? For example the ones that are near the center to be of d=10 and the ones further out to be with d=2?
YOu can see from the code that I uploaded that that would require a pretty big shift. The present code to replace pixels with circles of diamter d works by scaling up the image size by a factor of d in both directions.
Consider one of the aggregates I posted earlier, shown below. With your idea, the monomer at lower right in the red circle would be big, and the monomer at upper left would be small, with a gradation of size in between. If everything that touches now is still touching after the diameter transformation, then the closed loop formed by the aggregate inside the red circle would have to be distorted in a complex way to keep everything touching that touches now, especially if you want the monomers to remain circular. I doubt that it is possible to maintain touching-ness throughout the grid with circular monomers, if you scale the diamters from large in the center to small at the edges.
Yes you are probably correct! What if the monomers could overlap to form something like a tree branch?
@george korris, It sounds like you are really thinking of a 3D aggregate.
The current script builds the aggregate out of identical elements that can "stick" at the N, E, S, or W sides of other monomers in the aggregate. Thien the script represents those monomers as a bunch of circles that touch one another. If I were to build aggregates out of monomers that get smaller as the aggregate grows outward, then I would start over. I would no longer represent the aggregate as a 2D array of values that are 0 or 1. Instead, I would consider saving it as a structure array whose size increases by 1 each time a new monomer is added. Each element of the array represents one monomer in the structure. Each element would contain the radius of that particular monomer and its location (x,y coordinates of its center). THen the aggregate would grow one monomer at a time, each new monomer would be a little bit smaller than the one before. You will have to develop a growth routine: how do you model the griwth process. It sounds challenging.
What aggregate grows this way? I did not encounter such aggregates when I worked in the polymers department of a big chemical company.
Yes you are correct @William Rose! Sorry to bother you! You are awesome ! Thank you for your valuable time and comments!
@george korris, you’re welcome and good luck aggregating🙂

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by