Chaos game: Difference between revisions

Replaced "bitmap" and "bresenham" with "imageman".
(Replaced "bitmap" and "bresenham" with "imageman".)
Line 1,496:
 
==={{header|Writing result into an image}}===
{{libheader|imageman}}
We use the module “bitmap” from the task “Bitmap”, the module “bresenham” from the task “Bitmap/Bresenham's line algorithm” and the module “ppm_write” from the task “Bitmap/Write a PPM file”.
 
<lang Nim>#import Image management.math
import bitmap
import bresenham
import ppm_write
 
import math
import random
 
import bitmapimageman
 
const
Line 1,548 ⟶ 1,545:
const
Iterations = 50_000
Black = ColorRGBU [byte 0, 0, 0]
PointColor = color(255, 255, 0) # Color for points.
White = ColorRGBU [byte 255, 255, 255]
PointColor = color(ColorRGBU [byte 255, 255, 0)] # Color for points.
 
# Points in image coordinates.
Line 1,558 ⟶ 1,557:
 
randomize()
letvar image = newImageinitImage[ColorRGBU](Width, Height)
image.fill(Black)
 
Line 1,575 ⟶ 1,574:
p = ((p.x + T[idx].x) / 2, (p.y + T[idx].y) / 2)
 
image.writePPMsavePNG("xchaos_game.ppmpng")</lang>
 
=={{header|PARI/GP}}==
Anonymous user