Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Drawing series of circles

Subject: Drawing series of circles

From: Zeeshan

Date: 25 Dec, 2010 05:00:19

Message: 1 of 12

Dear Fellows/Expert

I have a 2D work plane of 100 mm x 160 mm. In this work plane I want to draw following two series of circles:

Series 1;

Circles filled in the above work plane such that each of circles has radius of 1.5. However the distance between the centers of circles is uniformly distributed with mean of 3.25 mm and standard deviation of 0.083mm

 Series 2;

Circles filled in the above work plane such that the distance between the centers of any two circles is 3mm. However the size of the circles is uniformly distributed with mean of 0.75 mm and standard deviation of 0.25.

I will be grateful to you if you please solve this problem of mine. I will therfore be highly grateful to you.

Waiting for replies
Zeeshan

Subject: Drawing series of circles

From: ImageAnalyst

Date: 25 Dec, 2010 05:29:16

Message: 2 of 12

Check out the FAQ:
http://matlab.wikia.com/wiki/FAQ#How_do_I_create_a_circle.3F
You'll also need the rand or randn function to get your random
locations.

Series 2 is (almost) impossible. You can't have every pair of circles
be 3 units apart unless you have only 2 or 3 circles. If they have a
distribution of distances apart then they are no longer exactly 3 mm
apart anymore, are they? But it can be done. If you have exactly 3
circles, they can completely cover/fill the plane and have the mean
and sd you require. Of course the circles will overlap and extend
beyond the rectangular boundaries of your area. Think about it and
you'll realize how to solve it. It sounds like homework so I won't
solve it for you.

Subject: Drawing series of circles

From: Walter Roberson

Date: 25 Dec, 2010 06:05:23

Message: 3 of 12

On 24/12/10 11:00 PM, Zeeshan wrote:

> I have a 2D work plane of 100 mm x 160 mm. In this work plane I want to
> draw following two series of circles:
>
> Series 1;
> Circles filled in the above work plane such that each of circles has
> radius of 1.5. However the distance between the centers of circles is
> uniformly distributed with mean of 3.25 mm and standard deviation of
> 0.083mm
> Series 2;
>
> Circles filled in the above work plane such that the distance between
> the centers of any two circles is 3mm. However the size of the circles
> is uniformly distributed with mean of 0.75 mm and standard deviation of
> 0.25.

The solution for #2 involves exactly 3 circles, as that is the maximum
number of points (centers) that can be chosen on a 2D plane such that
every point (center) is exactly 3mm away from every other point (center).

The solution for #1 requires a clarification of what "the distance
between the centers of circles" means in that context.

Subject: Drawing series of circles

From: Walter Roberson

Date: 25 Dec, 2010 06:16:28

Message: 4 of 12

On 24/12/10 11:29 PM, ImageAnalyst wrote:

> Series 2 is (almost) impossible. You can't have every pair of circles
> be 3 units apart unless you have only 2 or 3 circles. If they have a
> distribution of distances apart then they are no longer exactly 3 mm
> apart anymore, are they? But it can be done. If you have exactly 3
> circles, they can completely cover/fill the plane and have the mean
> and sd you require.

I don't think so, ImageAnalyst. When you have a prescribed mean and
standard deviation for exactly 3 objects, you can calculate the exact
sizes of the objects (but not the order.) The areas of those 3 objects,
even non-overlapping, would not cover 100mm x 160mm, not even close. You
would have to ignore the information about the mean in order to get
close to coverage.

Covering the area is, fortunately, not a stated requirement, just
drawing circles that meet the constraints.

Subject: Drawing series of circles

From: Zeeshan

Date: 25 Dec, 2010 08:01:05

Message: 5 of 12

Thanks all for replying the message.

Let me clarify my question once again.

Series 2

It is a case when 33 circles in x direction and 53 circles in y direction are requited to be ploted. Becuase if the width of workplane is 100 (or 99 mm), maximum number of circles with radius 1.5 mm is 33. Same thing happens with the height as we are can only plot 53 circles along the height . So total number of random normal distributed values is 33 x 53 = 1749 values ( or 1749 circles) with mean=0.75 mm and standard deviation = 0.25 . Once we have 1749 random values it is simply a case to plot circles at coordinates such that each circle is 3mm part of another.. say if the first circle lies at (3,3) the second lies (6,3), then ( 9,3)...... (99,3) Now in the second row (3,6), ( 6,6,.... (99,6)...This repeats until the 160th row ( 3, 160), (6,160)..... (99,160)


Series 1

This is a case when the radius (15mm) of circle is fixed but its location is not... The worst case is when the two circles touches each other ( the distance between them is 3mm) Here I am not sure how many circles are needed to be plotted as the distance between circles is keep changing with mean = 3.25 mm and standard deviation of 0.083mm .

I hope that this will clariy the situation

Subject: Drawing series of circles

From: ImageAnalyst

Date: 25 Dec, 2010 14:45:18

Message: 6 of 12

Walter, you're right. That area is too big. If one circle covered
the entire 100x160 area, then the others would have to have negative
radii to have a mean of 3, and that can't be. The diagonal of the
rectangle would have to be shorter than 4.5 for this to work.
(r1+r2+r3)/3 = 0.75
r1> 3 * 0.75 = 2.25
diagonal = 2*r1 >= 2*2.25 >= 4.5.

Subject: Drawing series of circles

From: ImageAnalyst

Date: 25 Dec, 2010 16:07:13

Message: 7 of 12

Regarding series 1. No it doesn't clarify. If the radii are all 15
mm, then how can the "distance between them" be 3? What is "them"?
Is that the *centers* of the circles, in which case the must be
overlap? Or is "them" the *perimeters*, and you have 3 mm between
perimeters? And in your "worst case" where the two 15 mm circles are
touching, how can you say that "the distance between them is 3mm"?
The distance between the centers of touching 15 mm radii circles is 30
mm, and the distance between perimeters of touching 15 mm radii
circles is 0 mm. So how are you getting 3????

Maybe you need to upload a diagram somewhere.

And I don't have time now to dive into your explanation of series 2
(the first one you explained), but I strongly suspect (based on your
series 1 "clarification") that is also unclear and you should look
that over also and include diagrams.

Subject: Drawing series of circles

From: Walter Roberson

Date: 25 Dec, 2010 16:48:17

Message: 8 of 12

On 25/12/10 2:01 AM, Zeeshan wrote:

> Let me clarify my question once again.
> Series 2
> It is a case when 33 circles in x direction and 53 circles in y
> direction are requited to be ploted. Becuase if the width of workplane
> is 100 (or 99 mm), maximum number of circles with radius 1.5 mm is 33.
> Same thing happens with the height as we are can only plot 53 circles
> along the height . So total number of random normal distributed values
> is 33 x 53 = 1749 values ( or 1749 circles) with mean=0.75 mm and
> standard deviation = 0.25 .

(X, Y) = ndgrid(1.5:3:100, 1.5:3:160);
S = (rand(size(X)) - 1/2) * sqrt(3) / 2 + 3/4;
for K = 1 : numel(X)
   rectangle('Position',[X(K) - S(K), Y(K) - S(K), S(K), S(K)],
'Curvature', [1 1]);
end

If you do not understand the S formula, then review the formula for
standard deviation of a uniform random distribution and solve that
formula together with the formula for the mean in order to determine
what the endpoints of the uniform distribution have to be in order to
meet your goals.

By the way: under the requirements stated, if one is permitted to choose
which circles are placed where (a possibility not ruled out by your
statement of the _distribution_ of sizes), then there is a denser
packing possible than the rectangular lattice you have chosen.

Subject: Drawing series of circles

From: Zeeshan

Date: 25 Dec, 2010 20:20:20

Message: 9 of 12

Hi Walter

Yes you're right its a typo error .. The right figure is 1.5 mm not 15 mm

Subject: Drawing series of circles

From: herman0123

Date: 25 Dec, 2010 20:47:43

Message: 10 of 12

your drawing of circle series is goig to shocked.
============================================
[url=http://www.savingsbest.org]Savings Account[/url]

Subject: Drawing series of circles

From: Walter Roberson

Date: 25 Dec, 2010 21:29:38

Message: 11 of 12

On 25/12/10 2:20 PM, Zeeshan wrote:
> Hi Walter
>
> Yes you're right its a typo error .. The right figure is 1.5 mm not 15 mm

That was someone else, not me. I gave the grid algorithm.

Subject: Drawing series of circles

From: Zeeshan

Date: 29 Dec, 2010 06:35:20

Message: 12 of 12

Thank you Mr Walter so much as you've resolved my problem by replying my private email. It was a great help to me .

Thanks to all those who participate in the discussion.

Zeeshan

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us