Effect Voronoi or Mosaic random

Bug #171901 reported by Bug Importer
2
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Wishlist
Unassigned

Bug Description

it's possible to make a texture type scale with inkscape, already it
exists this effect or functionality?

view:
http://valessiobrito.info/projetos/inkscape/texture_vector.png

effect "mosaic"

--
.ValessioBrito - http://valessiobrito.info

On 4/24/07, Terry Brown <terry_n_brown@ya...> wrote:
> I don't think inkscape has that. Looks like the POV-ray pattern
> 'Crackle':
>
> http://www.povray.org/documentation/view/3.6.1/372/
>
> --clip--
> Mathematically, the set crackle(p)=0 is a 3D Voronoi diagram of a
> field of semi random points and crackle(p) < 0 is the distance from
> the set along the shortest path (a Voronoi diagram is the locus of
> points equidistant from their two nearest neighbors from a set of
> disjoint points, like the membranes in suds are to the centers of
> the bubbles).

By the way, this might make a useful Python effect for Inkscape: Fill
the inside of a path with random points and build a Voronoi diagram
(as a set of polygon paths) of these points, or of the path's nodes,
or both. Any takers?

See http://en.wikipedia.org/wiki/Voronoi

--
bulia byak
Inkscape. Draw Freely.
http://www.inkscape.org

Related branches

Revision history for this message
Bug Importer (bug-importer) wrote :

View:

http://www.cs.sunysb.edu/~algorith/implement/fortune/distrib/voronoi.c

...

Xara has a effect of this or seemed.

Revision history for this message
Bug Importer (bug-importer) wrote :

Bill Baxter wrote:
Doing Voronoi diagrams (and delaunay triangulations) robustly is
tricky. Simpler algorithms tend to barf on input that has too many
collinear points, or has points placed exactly on a grid. And the
textbook implementations usually avoid constraints altogether.
But the Triangle lib by Jonathan Shewchuk handles all that and more
quite beautifully and can create both Voronoi diagrams and Delaunay
triangulations of the interiors of arbitrary polygons. (Arbitrary in
the sense of being concave and having holes. Probably not
self-intersecting ones, though I haven't tried that).

http://www.cs.cmu.edu/~quake/triangle.html

The license is a bit odd though. Has some odd advertising
requirements and commercial product restrictions:
------------------------------------------------------------------------------

These programs may be freely redistributed under the condition that the
copyright notices (including the copy of this notice in the code comments
and the copyright notice printed when the `-h' switch is selected) are
not removed, and no compensation is received. Private, research, and
institutional use is free. You may distribute modified versions of this
code UNDER THE CONDITION THAT THIS CODE AND ANY MODIF

---
Aaron Spike wrote:

Livarot used to do Voronoi diagrams.

http://livarot.sourceforge.net/

:-)

nightrow (jb-benoit)
Changed in inkscape:
importance: Undecided → Wishlist
status: New → Confirmed
tags: removed: other
Revision history for this message
ValessioBrito (valessio) wrote :

How I Did it:
http://openclipart.org/media/howididit/3480

mail archive discussion:

http://sourceforge.net/mailarchive/forum.php?<email address hidden>&forum_name=inkscape-user

Revision history for this message
Alvin Penner (apenner) wrote :

 Attached is a proposed extension that will generate a Voronoi diagram as a pattern. It shows up on the menu as Extensions->Generate from Path->Voronoi Pattern. It will create a pattern for the selected object, and the pattern Voronoixxxx can then be accessed from the Fill and Stroke dialog.
 The original algorithm and C code is from Steven Fortune, 1987 (voronoi.tar):
- http://ect.bell-labs.com/who/sjf/
- "A Sweepline Algorithm for Voronoi Diagrams", Algorithmica (1987) 2:153-174
 The Python translation of this code is from Bill Simons, 2005 (voronoi.py)
- http://www.oxfish.com/

 The extension consists of three files, voronoi.py, generate_voronoi.py, generate_voronoi.inx. The average size of the cells is adjustable. The extension will occasionally crash if the cell size is small. In this case the best thing to do is just retry, since the crash is a Python exit, not an Inkscape crash.

 Any feedback would be welcome...

Revision history for this message
Alvin Penner (apenner) wrote :
Revision history for this message
Alvin Penner (apenner) wrote :

attaching an updated version of generate_voronoi.py. This version will not crash, as far as I can tell.

Revision history for this message
jazzynico (jazzynico) wrote :

Tested on Windows XP, Inkscape 0.47.

Works nicely when only one object is selected (tested with various shapes, opened and closed freehand paths, text, 3D box side).
But it doesn't work:
* When two objects are selected (only the first is filled).
* On groups (Python crash).

Changed in inkscape:
status: Confirmed → In Progress
tags: added: pattern
Revision history for this message
Alvin Penner (apenner) wrote :

attaching an updated version of generate_voronoi.inx (and .py) to deal with the following issues:
* When two objects are selected (only the first is filled).
- unfortunately, I don't know how to fix this. The extension needs to know the bounding box of the objects. This is done using the command-line options --query-width, --query-height, which as far as I can tell, do not support multiple objects.

* On groups (Python crash).
- this should now work, and each object in the group will contain the pattern.

* at the dev list the comment was made that "the edges of the pattern tile won't match"
http://sourceforge.net/mailarchive/forum.php?thread_name=d470605b1001101527k49800fa5ma6ee2cb4d4bb73cb%40mail.gmail.com&forum_name=inkscape-devel

This is true, and so a new parameter has been added, border width. An adjustable border can be created around the four edges, which has the property that the points near to the bottom and top edges are reflections of each other, and similarly the points at the left and right edges are reflected. The result will be a continuous join at the edges, if the border is sufficiently wide. Generally, the border width will need to be wider than the average cell size. Zero border width produces the original result with all edges discontinuous, while 100% will produce the maximum amount of symmetry.

Revision history for this message
Alvin Penner (apenner) wrote :

Attached is an updated version of the pattern. The definition of the border has been modified to allow for the possibility of a completely smooth transition from one pattern to the next at the edges.
- choose zero border for a discontinuous edge.
- choose a positive border to replicate the pattern of seed points when generating the diagram, which will lead to a smooth join at the edges if the border is wide enough. To achieve smoothness, it will probably be necessary to make the border a bit larger than the average cell size, maybe twice the cell size.
- choose a negative border to reduce the size of the pattern and get a sparse region at the edges.

Revision history for this message
Alvin Penner (apenner) wrote :
Alvin Penner (apenner)
Changed in inkscape:
status: In Progress → Fix Committed
ScislaC (scislac)
Changed in inkscape:
milestone: none → 0.48
jazzynico (jazzynico)
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.