Jun 11, 2011

connect_centers_nearest_modified

I thought about how to create the objects to connect these centers by the script that I wrote previous time. And remembered a software Voronoi Stippler that I used a few years ago. (For some reason, it seems that it is unavailable for download now.)

I made the objects from an image with this tool, then applied the connect_centers_nearest.js script to them ... and got an error due to the upper limit of the number of points that setEntirePath function allows.

So I rewrote a part of the script as follows. Then I ran it again.
//path.setEntirePath(points);
for(i=0; i<points.length; i++){
with(path.pathPoints.add()){
anchor = points[i];
rightDirection = anchor;
leftDirection = anchor;
}
}
It seemed to be interesting. But it looked also like an ugly entangled string. So I implemented the idea of the maximum distance of the line to the script. If the distance between the points is longer than the limit, the script finishes the path and begins a new path from the next point.
This seems to be good? I posted this script at the end of this article.

In the archive, the script with .js extention is for windows. And .jsx is for Mac. When you run this script, you are asked the maximum distance in point. (Actually, it is the maximum squared distance. This is not appropriate. But I leave it as it is for now.)
Talking about the code, I put 0 instead of the coordinate [x, y], at the point that separates the paths.

download: aics_script_connect_centers_nearest_modified2.zip -> http://shspage.com/ex/files.html

2011.06.12 -- fixes length_limit to be squared 

5 comments:

  1. Hi, this looks pretty cool, and thanks for sharing it, however, I tried in Ai CS4 PC, and nothig happens, could yuo please post or send me some littel tuto about how it works? From what kin of grafic to start?
    mdinfomario@gmail.com

    ReplyDelete
  2. Excellent script... Excellent implementation. Thank you so much for sharing this workflow!

    I did a little Googling, and found a version of the voronoi stippler program here:
    http://www.saliences.com/projects/npr/stippling/stippling.html
    It exports svg from any src png file.
    I ran it, and it does seem to work on Windows 7 from the command line. If you have another implementation,I'd love to see it. Drop me a line through my contact page:
    http://www.wundes.com/contact.php

    thanks,
    -J

    ReplyDelete
  3. >Anonymous
    I wrote a little tutorial. I hope you can get how it works.

    >John
    I really respect your scripting works. So I'm so happy to hear from you!
    I tried the tool you introduced. It worked! But I think it can be faster to produce a result.
    You may be interested in these.
    Jonathan Puckey releases "Voronoi Tool" as a scriptographer script.
    http://scriptographer.org/scripts/interactive-tools/voronoi-tool/?front
    He uses the Voronoi library created by Raimond Hill.
    http://www.raymondhill.net/voronoi/rhill-voronoi.php
    For now, I don't know how it works. But I intend to study it sometime soon.

    ReplyDelete
  4. in processing: http://code.google.com/p/eggbotcode/downloads/detail?name=StippleGen_2.02.zip&can=2&q=stipplegen

    ReplyDelete
    Replies
    1. Nice application! Easy to use and works fast. Thanks!

      Delete

Note: Only a member of this blog may post a comment.