Skip to content

andyp1xe1/fun_shapes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 

Repository files navigation

fun_shapes

Algorithm:

  1. Generate Base (Average color of the image)
  2. generate n random shapes
  3. Create n new candidate states of the canvas
  4. Rank by fitness these candidates and choose the first (eucledian distance)
  5. Mutate the new state (only accept mutation if new image is better)
  6. Repeat until desired complexity is achieved

This algorithm is ran 3 times, each with a sligtht variation.

  • Stage 1: use a faster fitness function that levreages the Monte Carlo technique
  • Stage 2: use the standard fitnes function
  • Stage 3: add semi-transparent shapes for added smoothness

Results:

input image result


Stuff to do

  • decide on the language/platform: js. react native + expo
  • implement sketch of algorithm
  • make a demo UI

Backend

Image Processing

Functions:

Image Creation

Structures:

  • Shapes (representation of triangles, rectangles, ellipses, etc)
  • Canvas with state. (The actual canvas to draw. To be able to resume from a state, or undo actions on the canvas.)

Functions:

  • Generate random shape
  • Append shape to canvas
  • Export canvas to Image (SVG?)

Variation of Hill Climbing

This hypothetical variation borrows certain things from the genetic algorithms such as a fitness function and mutations. Hill Climbing was chosen due to it's simplicity and efficiency1

Functions:

  • Mutation (Vertex change of a triangle / radius change of an ellipse)

UI

The React Native app was replaced by a webpage.
The website receives svg shapes via a websocked and renders them in real time.


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published