Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
17
Task/Color-wheel/Sidef/color-wheel.sidef
Normal file
17
Task/Color-wheel/Sidef/color-wheel.sidef
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
require('Imager')
|
||||
|
||||
var (width, height) = (300, 300)
|
||||
var center = Complex(width/2 , height/2)
|
||||
|
||||
var img = %O<Imager>.new(xsize => width, ysize => height)
|
||||
|
||||
for y=(^height), x=(^width) {
|
||||
var vector = (center - x - y.i)
|
||||
var magnitude = (vector.abs * 2 / width)
|
||||
var direction = ((Num.pi + atan2(vector.real, vector.imag)) / Num.tau)
|
||||
img.setpixel(x => x, y => y,
|
||||
color => Hash(hsv => [360*direction, magnitude, magnitude < 1 ? 1 : 0])
|
||||
)
|
||||
}
|
||||
|
||||
img.write(file => 'color_wheel.png')
|
||||
Loading…
Add table
Add a link
Reference in a new issue