55 |
float k = rand.nextFloat() * 2 -1; |
float k = rand.nextFloat() * 2 -1; |
56 |
float j = (float)Math.cos(k - Math.PI/2); |
float j = (float)Math.cos(k - Math.PI/2); |
57 |
|
|
58 |
float ratio = rand.nextFloat(); |
float ratio = rand.nextFloat()*0.7f + 1.5f; |
59 |
Color c1 = getUniqColor(); |
Color c1 = getUniqColor(); |
60 |
Color c2 = getUniqColor(); |
Color c2 = getUniqColor(); |
61 |
|
|
62 |
float a=0; |
float a =(float) Math.PI * rand.nextFloat(); |
|
for (boolean again=true; again;) { |
|
|
try { |
|
|
a =(float) Math.PI * rand.nextFloat(); |
|
|
Math.tan(a); |
|
|
again = false; |
|
|
} catch (ArithmeticException e) { again = true; } |
|
|
} |
|
63 |
if (a > Math.PI/4 && a <= Math.PI *3f/4) { |
if (a > Math.PI/4 && a <= Math.PI *3f/4) { |
64 |
// verticals.. |
// verticals.. |
65 |
|
|
66 |
float linew = mw/(rand.nextInt()%5 + 3); |
float linew = mw/((Math.abs(rand.nextInt())%5) + 3); |
67 |
float begin_x; |
float begin_x; |
68 |
float f = mx + mw/2 + panx*zoom; |
float f = mx + mw/2 + panx*zoom; |
69 |
|
|
70 |
// >> if too far we have to be at least mw away from mx. |
// >> if too far we have to be at least mw away from mx. |
71 |
while ( f < mx - 2*mw) { |
while ( f < mx - 2*mw) { |
72 |
|
try { |
73 |
f += Math.abs( ((ratio * linew)/j)*zoom ); |
f += Math.abs( ((ratio * linew)/j)*zoom ); |
74 |
f += Math.abs( (((1-ratio) * linew)/j)*zoom ); |
f += Math.abs( (((1-ratio) * linew)/j)*zoom ); |
75 |
|
} catch (Exception e) { pa("e:"+e); } |
76 |
} |
} |
77 |
|
|
78 |
// << if too near |
// << if too near |
79 |
while( f > mx-2*mw ) { |
while( f > mx-2*mw ) { |
80 |
f -= Math.abs( ((ratio * linew)/j)*zoom ); |
f -= Math.abs( ((ratio * linew)/j)*zoom ); |
130 |
|
|
131 |
//pa("x"+x+"y"+y+"w"+w+"h"+h); |
//pa("x"+x+"y"+y+"w"+w+"h"+h); |
132 |
|
|
|
|
|
133 |
g.setColor(Color.gray); |
g.setColor(Color.gray); |
134 |
g.fillRect(x, y, w, h); |
g.fillRect(x, y, w, h); |
135 |
|
|
|
|
|
136 |
g.setColor(oldfg); |
g.setColor(oldfg); |
137 |
g.setClip(oldClip); |
g.setClip(oldClip); |
138 |
} |
} |