English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

In x-y plane, draw multiple touching circles of 1 inch radius with centre at even numbers i.e circles of 1 unit radius at (0,0) ; (2,0) ; (4,0) etc.. similarly at (0,2), (0, 4)… (2,4), (2,6) etc. filling all quadrants.

We wish to pack entire x-y plane with pixels having dia d1. Assume 100 pixels pack into 1 unit radius i.e 100*d1 = 1 inch.

Each pixel is a progressive shade of black. At Circle centers, pixel is 75% black. At periphery of circle, its 25% black i.e. shade progressively reduces as it radiates out until it meets the line radiating from adjacent circle.

e.g. lines from (0,0) and (0,2) will start at 75% from their respective centres; meeting at (0,1) where pixel will be 25% black. In between the shade is continuous progression from 75% to 25%. As you will note, lines from (0,0) and (2,2) radiating towards each other will meet at (1,1) which is outside the circle, so the shade of pixel at (1,1) will be less than 25% (but in the same ratio of progression)

2006-09-20 16:46:20 · 4 answers · asked by Anonymous in Science & Mathematics Mathematics

To sum: We are given R0 (radius of circles), d1 (diameter of pixel), progression of reduction (reduces from 75% to 25% over a distance R0). We need to determine shade of pixel for any given (x,y)

The equation for 1 circle is easy. What we need is an equation that is smart enough to figure where exactly the pixel lies on plane..i.e x/R0 and y/R0 should definitely figure in the equation.

2006-09-20 16:46:54 · update #1

To answer Helmut’s question,
1) The shading is not progressive. So for example s(4,4) will be same as s(1,1)
2) the shading progression is linear. i.e at (0,0) shading is 0.75 unit, at (0,1) it is 0.25. So it falls 0.5 shade units in 1 unit distance. Therefore at (1,1)i.e 1.414 unit it will reduce by 1.414*0.5 = 0.7 i.e remainder at that point will be 0.75 – 0.7 = 0.05 unit.

2006-09-20 17:59:49 · update #2

We need the answer as a maths equation. A computer program is not an option.

2006-09-20 18:05:58 · update #3

Modulo is a programming function. How can it be represented mathematically in equation?

2006-09-20 18:12:45 · update #4

4 answers

I understand that you're looking for an equation to give you a pixel shade as a function of a given set of coordinates (x,y).

I hope you understand modulo, because I think that's the easiest way to accomplish this.

Since it's a repeating pattern, you can map back any set of (x,y) back to the circle at the origin as follows:
x0 = [(x+1) mod 2] - 1
y0 = [(y+1) mod 2] - 1

Then you calculate the distance of (x0,y0) from the origin:
d = (x0 ^ 2 + y0 ^ 2) ^ 0.5

and then shade = d * 0.5 +.25

As for the part outside the circle, where d>1, it sounds like you're using a computer, so you can use a conditional statement to handle that.


EDIT:
Upon rereading the description, it sounds like the shading doesn't stop at the circle. So you don't need a conditional statement.

And modulo is math. And it's represented exactly as I wrote it.


Here are the above equations combined into one:

shade = [[(([(x+1) mod 2] - 1) ^ 2 + ( [(y+1) mod 2] - 1) ^ 2) ^ 0.5] * .5] +.25

2006-09-20 17:41:34 · answer #1 · answered by samk 4 · 0 0

More information is needed, eg.:
1) Are the shadings additive? in other words, at the 11 point is the effect S(1,1)=4*s(1.414,1.414) + distant effect of other pixels?
2) How does the shading of the single pixel progress? A "real world" assumption might be exponentially..

2006-09-21 00:32:24 · answer #2 · answered by Helmut 7 · 0 0

Steps:
1. Find the circle that is nearest to the point. Use the Mod or digital divide function or even round function (less step here). Then get the center of that circle. Combine them this way:

center=(200*Round(x/200), 200*Round(y/200))

2. Find the x_distance and the y_distance of the point to the center of that circle. Then find the absolute distance (r) of the point to the centre of that circle. Use Sqrt(x_distance ^2 + y_distance ^2).

r=Sqrt((x-200*Round(x/200))^2 + (y-200*Round(y/200))^2)

3. Shade the point accordingly.
shade=75%-50%*r/100
=75% - 50%*
Sqrt( (x-200*Round(x/200))^2 + (y-200*Round(y/200))^2 ) /100

Bingo!

2006-09-21 01:57:45 · answer #3 · answered by Jacob Gan 2 · 0 0

Try using a sine or cosine function and have the function have a wavelength of the diameter. You'll need two sets of sine functions. One for the x and one for the y, but it would appear that you can use the same wavelength for both. The formula would look something like this:

A(25%)cos(x/d)cos(y/d)+A(50%)

The amplitude may or may not exactly be correct, but you should be able to play with it to get the desired effect.

2006-09-21 00:08:49 · answer #4 · answered by kain2396 3 · 0 0

fedest.com, questions and answers