Tw1ddle/geometrize-haxe
关于
:triangular_ruler: Geometrize is a Haxe port of primitive that geometrizes images into geometric primitives
设计与媒体可以做什么
- 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.
实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文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.
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 | ![]() |
![]() |
![]() |
| Triangles | ![]() |
![]() |
![]() |
| Rotated Rectangles | ![]() |
![]() |
![]() |
| Rotated Ellipses | ![]() |
![]() |
![]() |
| 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 aBitmaptarget image and a starting backgroundRgbacolor. - Generate shapes by repeatedly calling
runner.step(options), passing in yourImageRunnerOptions. - Export the results using the
exportmethods onSvgExporterandShapeJsonExporter.
Refer to the library documentation. Also see the Geometrize Haxe web demo and code, or this HaxeFlixel example and code.
Resources
- See the Geometrize resources page.
Examples And Screenshots
Geometrized public domain artwork and photos:
For more examples, see the Geometrize gallery.
Notes
探索相关项目
加载中…



























