fogleman / primitive

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

Other potential mode #20

Closed bmaltais closed 7 years ago

bmaltais commented 7 years ago

Very interesting what you have done.

I was wondering if the following mode would not provide even better fit quicker:

bestscore = 1
for each mode (triangle, rectangle, etc, etc)
  get newscore
  if newscore is < bestscore then keep output
end
return best shape

This way you would get a blend of shapes that provide the quickest score decrease based on the best shape for the iteration.

Trying to understand the source code so I could try to implement. This could become a new -m option for "optimized blend mode"

fogleman commented 7 years ago

This is basically what combo mode does already.

bmaltais commented 7 years ago

OK. Reading the code I tought it was just picking one at random:

return model.RandomState(buffer, ShapeType(rnd.Intn(5)+1), a, rnd)

I interpreted this as a single pass based on a random pick of one of the possible mode... not cycling exhaustively through each to find the best fit for the iteration.

I am not seeing the for loop across all possible mode for that option. I might be reading the code wrong.