fogleman / primitive

Reproducing images with geometric primitives.
https://primitive.lol/
MIT License
12.35k stars 608 forks source link

New code as of Oct 3 21h34 PM issues #33

Closed bmaltais closed 7 years ago

bmaltais commented 7 years ago

I noticed the following issue:

worker.go:

func (worker *Worker) RandomState(t ShapeType, a int) *State {
    switch t {
    default:
        return worker.RandomState(ShapeType(worker.Rnd.Intn(6)+1), a)

should be changed to

func (worker *Worker) RandomState(t ShapeType, a int) *State {
    switch t {
    default:
        return worker.RandomState(ShapeType(worker.Rnd.Intn(8)+1), a)

I also noticed that the SVG vs PNG images produced are quite different:

http://imgur.com/a/uRtQg

I used the following to produce the output:

primitive -i dst.jpg -o testdst.svg -o testdst.png -n 500 -v -a 0 -m 0 -r 512 -s 512 -rep 5

fogleman commented 7 years ago

Fixed the 1st issue. The 2nd is because I haven't implemented SVG for Polygon yet.

bmaltais commented 7 years ago

OK ;-) The output of the png is amazingly similar to the original. I realize that it is because more than 2500 primitives are used (actually 3000 given the -n 500 -rep 5) but it is really good.