Skip to content

Commit a052cef

Browse files
committed
descr
1 parent 29a0a56 commit a052cef

File tree

6 files changed

+1375
-53
lines changed

6 files changed

+1375
-53
lines changed

README.md

+16-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[Procedural texture](https://en.wikipedia.org/wiki/Procedural_texture)
2-
* 2D [color gradient](https://en.wikipedia.org/wiki/Color_gradient)
2+
* 2D [color gradient](https://en.wikipedia.org/wiki/Color_gradient). For 1D color gradient see [here](https://gitlab.com/adammajewski/color_gradient)
33
* [defined by a function whose value is computed rather than looked up](http://math.hws.edu/graphicsbook/c7/s3.html)
44

55

@@ -64,7 +64,6 @@
6464
![](./images/cabsi.png "cabs inverted")
6565

6666
### carg(z)
67-
![](./images/carg.png "carg")
6867
![](./images/cargm.png "carg modified")
6968
![](./images/cturn.png "cturn")
7069
![](./images/conic.png "conic")
@@ -115,12 +114,16 @@ Parts
115114

116115

117116
## color modes
117+
* color depth
118+
* color from palette
119+
118120

119121
[Color depth](https://en.wikipedia.org/wiki/Color_depth)
120122
* 24 bit color (rgb)
121123
* 8 bit color mode: gray shades ( where r=g=b)
122124
* 1 bit color mode: Black and White ( b&w )
123-
* direct color, palette mode
125+
126+
124127

125128
```pas
126129
case ColorType of
@@ -222,9 +225,10 @@ double conic(double complex z)
222225
223226
// https://en.wikipedia.org/wiki/Himmelblau%27s_function
224227
double GiveHimmelblau(double x, double y){
225-
// mapped input to [-6,6]x[-6,6]
226-
x *= 6.0;
227-
y *= 6.0;
228+
// map input to [-m,m]x[-m,m]
229+
double m = 6.0;
230+
x *= m;
231+
y *= m;
228232
double a = x*x+y-11.0;
229233
double b = x+y*y-7.0;
230234
// mapped output to
@@ -241,11 +245,15 @@ double GiveHimmelblau(double x, double y){
241245
*/
242246
double checker( double x, double y){
243247

244-
int ix = floor(5.0*x);
245-
int iy = floor(5.0*y);
248+
double m = 5.0;
249+
// map input from [-1,1]x[-1,1] to [-m,m]x[-m,m]
250+
int ix = floor(m*x);
251+
int iy = floor(m*y);
246252

247253

248254
return abs(ix + iy) % 2;
255+
256+
249257
}
250258
```
251259

0 commit comments

Comments
 (0)