Tw1ddle / geometrize-haxe

:triangular_ruler: Geometrize is a Haxe port of primitive that geometrizes images into geometric primitives
https://www.geometrize.co.uk/
Other
348 stars 31 forks source link

web demo : focus areas #3

Closed mastef closed 2 years ago

mastef commented 6 years ago

This is a more complex issue so not sure how feasible - however sometimes I want to keep a background that has less shapes, and focus the new shapes on a certain area in the foreground. It would be nice to be able to select an area that the shapes would be generated in for the next steps.

This is also nice when you create the initial image with e.g. triangles, and then in later steps switch strategies to e.g. ellipses/circles and so on

Tw1ddle commented 6 years ago

This is something I have in mind for the C++/Qt desktop application where I started tinkering with ChaiScript scripts.

It would come down to defining custom logic for spawning/mutating the shapes - in this case to keep shapes confined within other masked areas/shapes.

I'd approach this by making the relevant shape spawning/mutation functions rebindable, and then injecting my own scripts. Then some sort of drawing tool to define focus areas in the GUI would be a layer on top of that.

mastef commented 6 years ago

A simple rectangle could be easy enough, right? So the randomly spawned shapes would have to be within the x,y,width,height boundaries

Tw1ddle commented 6 years ago

Yes - a constraint that only allowed the shapes to spawn and then mutate/move within an area would be simple enough.

It'd be a matter of changing the constructors and mutate() methods of the shape classes to have those constraints e.g in here: https://github.com/Tw1ddle/geometrize-haxe/blob/master/geometrize/shape/Ellipse.hx

Tw1ddle commented 2 years ago

I've implemented this in my C++ desktop app that I'll release a new build of very soon (https://github.com/Tw1ddle/geometrize) - thanks for the suggestion. I'm not planning to implement it again in Haxe though, so I'm closing this