Geometrize Haxe is a Haxe library for recreating images with geometric primitives. Run the demo in your browser.
- Recreate images as geometric primitives - rectangles, rotated rectangles, triangles, circles, ellipses, rotated ellipses and lines are supported.
- Export generated shape data to JSON.
- Export geometrized images as SVGs.
- All Haxe targets are supported.
The matrix shows typical results for circles, triangles, rotated rectangles, rotated ellipses and all supported shapes at 50, 200 and 500 total shapes:
|-||50 Shapes||200 Shapes||500 Shapes|
How It Works
A user provides a target image, and the algorithm finds shapes to approximate that image. To identify a good shape, the algorithm generates a large number of random candidate shapes, repeatedly improving the fit of each using a hillclimbing optimization approach, eventually choosing the best-fitting shape. The shapes are added one by one.
- Instantiate an
ImageRunner, passing it a
Bitmaptarget image and a starting background
- Generate shapes by repeatedly calling
runner.step(options), passing in your
- Export the results using the
- See the Geometrize resources page.
Examples And Screenshots
For more examples, see the Geometrize gallery.