Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'line connects circle centers' topicStudent Support Forum > General > "line connects circle centers"

Next Comment >Help | Reply To Topic
Author Comment/Response
roescu
05/23/08 9:35pm

Hi,
I have made a plot to put some circles at some positions i needed. This was difficult for me as i am not very familiar yet with Mathematica.
To complete the picture, i need to connect the centers of the circles with a mesh of straight horizontal and vertical lines, the lines being behind the circles in the end. i have tried something but it is too complicated what i have done.
does anybody have any idea how to do it?
thanks a lot.

roescu


here are the circles:

parameter1 = 1;
parameter2 = 1.25;
p = Array[pp, 123];(*length should be equal with "i*j"*)
ww = 0; (*Index for "p" array*)
q = Array[qq, 82];(*length should be equal with "ii*jj"*)
www = 0; (*Index for "q" array*)
For[i = -20, i <= 20, i++,(*index for X coordinates*)
For[j = 1, j <= 3, j++, (*index for Y coordinates*)
ww = ww + 1; (*increment inside "p" array*)
xx = i parameter1; (*take the X coordinate*)
yy = j parameter1; (*take the Y coordinate*)
p[[ww]] = Disk[{xx, yy}, 0.3]; (*fill the "p" array*)
]
]
For[ii = -20, ii <= 20, ii++,(*index for X coordinates*)
For[jj = 1, jj <= 2, jj++, (*index for Y coordinates*)
www = www + 1; (*increment inside "q" array*)
xxx = ii parameter1; (*take the X coordinate*)
yyy = jj parameter2 +
3 parameter1; (*take the Y coordinate but take care to shift on \
vertical with 3 units if j=3 in the previous loop*)
q[[www]] = Disk[{xxx, yyy}, 0.35] (*fill the "q" array*)
]
]
imaginea =
Show[Graphics[{Orange, p}], Graphics[{Blue, q}], ImageSize -> 800]

URL: ,

Subject (listing for 'line connects circle centers')
Author Date Posted
line connects circle centers roescu 05/23/08 9:35pm
Re: line connects circle centers yehuda ben-s... 05/25/08 4:09pm
Re: line connects circle centers Jim 05/26/08 03:44am
Re: line connects circle centers Xavier 05/26/08 11:19am
Re: line connects circle centers roescu 05/26/08 9:55pm
Re: line connects circle centers Jim 05/29/08 03:56am
Next Comment >Help | Reply To Topic