Code covered by the BSD License  

Highlights from
Growbubbles - maximum radius packing

3.0

3.0 | 2 ratings Rate this file 16 Downloads (last 30 days) File Size: 2.21 KB File ID: #33213
image thumbnail

Growbubbles - maximum radius packing

by Sven

 

10 Oct 2011

Growbubbles takes centroid points and returns the maximum radius circles or spheres without overlap

| Watch this File

File Information
Description

%GROWBUBBLES packs maximum radius circles at given central locations
%
% PTRADS = GROWBUBBLES(PTS) returns the radius of circles at coordinates in PTS with all radii
% maximised but without any circles overlapping. PTS is a P-by-N matrix of P "N-dimensional"
% points.
%
% If no output argument is given, PTSIN will be plotted as circles (2D) or spheres (3D) to the
% current figure.
%
% Example:
%
% % Find the maximum packed radius of 20 random points
% x = rand(20, 2);
% ptRads = growbubbles(x);

MATLAB release MATLAB 7.13 (2011b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (7)
23 Nov 2011 Yuri

Your program looks very interesting, but when I run it, I got the error message:

??? Error: File: growbubbles.m
Line: 42 Column: 7
Expression or statement is incorrect--possibly unbalanced (, {, or [.

for which versions did you test it?

23 Nov 2011 Sven

Ah... that's the tricky little tilde (~) operator. It was introduced in version 2009b. If you use an earlier version, just change the line:

[~,idx] = min(openPtMinGap);

into:

[dummyVariable,idx] = min(openPtMinGap);

and it should run just fine.

24 Nov 2011 Yuri

Thanks! Now it works!

24 Nov 2011 Yuri

Well well well, but why some spheres have no contact with others? Even in your plot we see this.

24 Nov 2011 Yuri

Ok, I red the code and found answer: the code is fast, simple, but... can not produces "connected media". It's a pity

24 Nov 2011 Sven

Yes Yuri, this entry grows bubbles with a *known* center. To make all bubbles grow more would require that they *break* this constraint. I get 3 stars because it doesn't solve a different problem entirely? Ouch! :)

24 Nov 2011 Sven

What would you do in the following instances:

1. You only have two circles. (If their centers moved, they would grow to infinity)

2. You have many circles. (All the outside circles would grow very close to infinity)

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
packing Sven 11 Oct 2011 10:40:25
pack Sven 11 Oct 2011 10:40:25
circle Sven 11 Oct 2011 10:40:25
sphere Sven 11 Oct 2011 10:40:25

Contact us at files@mathworks.com