|
SIMMETRICNE PODOBE 01 - program symmetry05

Image properties: Picture box
Picture1, Cartesian plain: x from –3 to +3; y from
–3 to +3; dimension: width 500
pixels, height 500 pixels,
command button for nex image
Result description: symmetrical image, curve-irregular shapes,
iridescent colors
Basic concept: polar coordinates (radius r and angle
fi) of the current pixel and some cycle-related
random values used as the only variables to define
the pixel color. Image forms and shapes are the
consequence of color distribution (algorithmic
programming approach).
Algorithm description: At the beginning a
defined number of random values are generated which
are later used as auxiliary constants. Then the
program calculates polar coordinates for each pixel
and uses them together with previous generated
constants to calculate the RGB color components.
There are two types of GRB components used: random
defined in the beginning of each cycle (k1, k2, k3)
and mathematically calculated (re, gr, bl). Image
area is processing by columns from left to right.
Download and run exe
version
Visual
Basic source
code
Private Sub Command1_Click()
Call draw
End Sub
Private Sub Form_Load()
Form1.Show: Randomize Timer
Call draw
End Sub
Private Sub draw()
Randomize Timer
On Error Resume Next: Cls
n1 = 5 + Rnd * 5: n2 = 5 + Rnd * 5: n3 = 5 + Rnd
* 5
f1 = Int(2 + Rnd * 10): f2 = Int(2 + Rnd * 10):
f3 = Int(2 + Rnd * 10)
k1 = Rnd * 256: k2 = Rnd * 256: k3 = Rnd * 256
typ = Int(1 + Rnd * 7)
For i = 0 To 500: For j = 0 To 500
x = (i - 500 / 2) / (500 / 6): y = (500 / 2 - j)
/ (500 / 6)
r = Sqr(x * x + y * y): fi = Atn(y / x)
re = k1 * ((n1 + Sin(n1 * r)) + (n2 + Cos(2 * f1
* fi))) Mod 256
gr = k2 * ((n2 + Cos(n2 * r)) + (n3 + Sin(2 * f2
* fi))) Mod 256
bl = k3 * ((n3 + Sin(n3 * r)) + (n1 + Cos(2 * f3
* fi))) Mod 256
If typ = 1 Then Picture1.PSet (i, j), RGB(re, gr,
bl)
If typ = 2 Then Picture1.PSet (i, j), RGB(k1, gr,
bl)
If typ = 3 Then Picture1.PSet (i, j), RGB(re,
k2, bl)
If typ = 4 Then Picture1.PSet (i, j), RGB(re, gr,
k3)
If typ = 5 Then Picture1.PSet (i, j), RGB(k1,
k2, bl)
If typ = 6 Then Picture1.PSet (i, j), RGB(re,
k2, k3)
If typ = 7 Then Picture1.PSet (i, j), RGB(k1, gr,
k3)
Next j: Next i
End Sub
|
|