• Stars
    star
    351
  • Rank 120,906 (Top 3 %)
  • Language Haxe
  • License
    Other
  • Created over 7 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

📐 Geometrize is a Haxe port of primitive that geometrizes images into geometric primitives

Project logo

License Build Status Badge Haxelib Version

Geometrize Haxe is a Haxe library for recreating images with geometric primitives. Run the demo in your browser.

Geometrize Haxe is part of Geometrize and was inspired by the primitive Go library.

Geometrized Cat 500 Triangles

Features

  • Recreate images as geometric primitives - rectangles, rotated rectangles, triangles, circles, ellipses, rotated ellipses, lines and beziers are supported.
  • Export generated shape data to JSON.
  • Export geometrized images as SVGs.
  • All Haxe targets are supported.

Shape Comparison

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
Circles 50 Circles 200 Circles 500 Circles
Triangles 50 Triangles 200 Triangles 500 Triangles
Rotated Rectangles 50 Rotated Rectangles 200 Rotated Rectangles 500 Rotated Rectangles
Rotated Ellipses 50 Rotated Ellipses 200 Rotated Ellipses 500 Rotated Ellipses
All Shapes 50 All Shapes 200 All Shapes 500 All 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.

JavaScript Usage

If you are working in JavaScript, check out geometrizejs which provides JavaScript API and types for this library, tested on browser and Node.js.

On top of it, geometrizejs-cli tool provides command line interface and support for common image formats.

Haxe Install

Get the Haxe library from GitHub or through haxelib:

haxelib install geometrize-haxe

Haxe Usage

  • Instantiate an ImageRunner, passing it a Bitmap target image and a starting background Rgba color.
  • Generate shapes by repeatedly calling runner.step(options), passing in your ImageRunnerOptions.
  • Export the results using the export methods on SvgExporter and ShapeJsonExporter.

Refer to the library documentation. Also see the Geometrize Haxe web demo and code, or this HaxeFlixel example and code.

Resources

Examples And Screenshots

Geometrized public domain artwork and photos:

Geometrized Flower 330 Rotated Ellipses Geometrized Train 230 Rotated Ellipses Geometrized Woodland Cemetery 600 Rotated Rectangles Geometrized Pomegranate 300 Rotated Ellipses Geometrized Monarch Butterfly 800 Various Shapes Geometrized Leafy Railroad 800 Rotated Rectangles Geometrized Pyramid 150 Triangles Geometrized Trees 210 Ellipses Geometrized Chomsky 300 Triangles Geometrized Trees 250 Rotated Ellipses Geometrized Fairies 500 Triangles

For more examples, see the Geometrize gallery.

Notes

  • This implementation is single-threaded, and performance varies by target platform. Small target images work best.
  • Got an idea or suggestion? Open an issue on GitHub, or send Sam a message on Twitter.
  • Find more related projects and open source code here.

More Repositories

1

geometrize

🔳 Geometrize is a desktop app that geometrizes images into geometric primitives
C++
1,906
star
2

MarkovNameGenerator

✒️ Markov process-based procedural name and word generator demo
JavaScript
446
star
3

Sky-Shader

☀️ WebGL sky and sun shader editor
JavaScript
136
star
4

geometrize-haxe-web

🌐 Web demo using the Geometrize Haxe library to recreate images with geometric primitives
JavaScript
136
star
5

game-of-life

🎲 Interactive Conway's Game of Life simulation written in Haxe
Haxe
75
star
6

WebGL-Distance-Fields

⭐ Realtime Euclidean distance field generation and rendering
JavaScript
63
star
7

geometrize-lib

🔶 C++ library for Geometrize, a tool for geometrizing images into geometric primitives
C++
61
star
8

Rectangle-Bin-Packing

👜 Haxe algorithms for 2D rectangular bin packing
Haxe
41
star
9

samcodes-admob

💸 Unofficial AdMob ads support for Haxe/OpenFL Android and iOS targets.
Objective-C
24
star
10

markov-namegen-lib

✒️ Markov process-based procedural name and word generator library
Haxe
23
star
11

samcodes-notifications

💬 Local device notification support for OpenFL Android and iOS targets
Haxe
23
star
12

haxe-kiwi

🐦 Haxe port of Kiwi, an implementation of the Cassowary constraint solving algorithm
Haxe
19
star
13

samcodes-chartboost

💰 Unofficial Chartboost ads support for Haxe/OpenFL Android and iOS targets
Objective-C
19
star
14

geometrize-haxe-demo

Demo using Geometrize Haxe and HaxeFlixel to recreate images with geometric primitives
Haxe
17
star
15

samcodes-ads-demo

💵 Demonstrates Haxe/OpenFL bindings for Chartboost ads haxelib
Haxe
15
star
16

geometrize-twitter-bot

Twitter bot for Geometrize, a tool for geometrizing images into geometric primitives
Python
14
star
17

geometrize-lib-example

Minimal example using the Geometrize library, a tool for geometrizing images
C
13
star
18

Ludum-Dare-33

🎮 Ludum Dare 33 entry "Otherworldly Stars"
JavaScript
12
star
19

needs-ai-lib

😀 Utility-based AI library written in Haxe
Haxe
12
star
20

Blind-Crossword-3D

🌟 2D and 3D crossword puzzle game for blind and partially-sighted users
C++
9
star
21

geometrize-tween-optimizer

A tool for creating visually appealing tweens between sets of geometric primitives
Haxe
9
star
22

samcodes-gamecircle

🏀 Unofficial GameCircle achievements and leaderboards for Haxe/OpenFL
Haxe
8
star
23

geometrize-tweens

Tweening between images composed of geometric primitives
Haxe
8
star
24

Rectangle-Bin-Packing-Demo

💼 Haxe 2D rectangle bin packing algorithms demo
Haxe
7
star
25

needs-ai-standalone

😀 Basic standalone utility-based AI demo written in Haxe
Haxe
7
star
26

geometrize-installer

Installer code for Geometrize, an app for geometrizing images into geometric primitives
QMake
6
star
27

samcodes-googleplaygames

Unofficial Google Play achievements and leaderboards for Haxe/OpenFL
Haxe
6
star
28

needs-ai

Demonstration for Needs AI, a utility-based AI library written in Haxe
Haxe
6
star
29

geometrize-scripts

ChaiScript scripts for Geometrize, an app for turning images into geometric primitives
6
star
30

webgl-palette-shader

✨ WebGL palette/toon shader demo using TypeScript and three.js
JavaScript
6
star
31

geometrize-top-level-repo

Top level repository and developer's landing page for checking out the Geometrize project
Shell
6
star
32

Screen-Space-Ambient-Occlusion

:shipit: Screen space ambient occlusion in WebGL
Haxe
5
star
33

word-reactor

🎱 A Markov process-based word generator inside a physics ballpool
JavaScript
5
star
34

geometrize-website

Landing webpage for Geometrize, a tool for geometrizing images into geometric primitives
Haxe
5
star
35

geometrize-web-export

Exporter to convert and render geometrized shape data in different web formats
Haxe
5
star
36

geometrize-s3-bucket-downloader

S3 bucket browser for Geometrize, an app for geometrizing images into geometric primitives
Haxe
5
star
37

samcodes-consent-demo

Demonstrates Haxe/OpenFL bindings for the Google Mobile Ads GDPR Consent SDK
Haxe
4
star
38

samcodes-notifications-demo

📨 Demonstrates Haxe/OpenFL bindings for Android and iOS local device notifications
Haxe
4
star
39

Stereoscopics

👀 Stereoscopic rendering methods
JavaScript
3
star
40

geometrize-lib-fuzzing

Fuzz testing harness for Geometrize, a library for geometrizing images into geometric primitives
C++
3
star
41

haxe-gamecentermanager

GameCenterManager Haxe bindings for OSX and iOS
Objective-C++
3
star
42

samcodes-consent

Google Mobile Ads Consent SDK Haxe bindings for Haxe OpenFL Android/iOS targets
Objective-C
3
star
43

geometrize-gallery

Gallery of images geometrized by Geometrize, a tool for transforming images into shapes
Haxe
3
star
44

haxe-kiwi-demo

🐦 Demo of a Haxe port of the Kiwi linear constraint solver
Haxe
3
star
45

geometrize-lib-unit-tests

Unit tests for Geometrize, a library for geometrizing images into geometric primitives
C++
3
star
46

geometrize-twitter-bot-docs

Geometrize bot docs, a Twitter bot for geometrizing images into geometric primitives
Batchfile
2
star
47

geometrize-templates

Templates for Geometrize, recreating images using geometric primitives
Python
2
star
48

geometrize-functional-tests

Test scripts for Geometrize, an app for geometrizing images into geometric primitives
Python
2
star
49

lycan-ld38-basecode

Outdated Ludum Dare 38 base code
Haxe
2
star
50

geometrize-docs

Documentation for Geometrize, a tool for geometrizing images into geometric primitives
Batchfile
2
star
51

tweak-gui

👉 tweak-gui is a simple to use Haxe user interface library for changing variables
JavaScript
2
star
52

dataslinger-lib

Experimenting with transferring data between processes in C++
C++
2
star
53

geometrize-translations

Translations for Geometrize, an app for turning images into geometric primitives
Python
2
star
54

needs-ai-editor

Utility-based AI editor written in Haxe
Haxe
1
star
55

Blind-Crossword-Editor

🕥 Enables blind or partially sighted users to create their own crosswords
C++
1
star
56

dataslinger

Experimenting with transferring data between processes in C++
C++
1
star
57

geometrize-haxe-example

Minimal example using the Geometrize Haxe library, a tool for geometrizing images
Haxe
1
star
58

geometrize-resources

Curated resources for Geometrize, recreating images using geometric primitives
1
star
59

Amsterdam-Light-Festival-2016

Concept for an Amsterdam Light Festival entry
JavaScript
1
star
60

savedata-salvaging-test

Test to see if some old HaxeFlixel/OpenFL savedata salvaging code works
Haxe
1
star