Copy link to clipboard
Copied
I'm trying to do following action using CS6 SDK:
1 Covert the selected path into chained circles
2 Fill the selected shapes with circles
All circles are of equal size, and cannot be overlapped each other.
Any reference/suggestions? thanks
Copy link to clipboard
Copied
Hello,
For the first question to replace a path by circles, you could do:
Get the length of the path with the MeasureSegments function in AIPath.h.
Calculate the centers positions. Divide the length of the path by the number of circles and use functions like
GetPathBezier (from AIPath.h) and TAtLength, PointAndTangent (from AIRealBezier.h).
When you have the positions of the centers, you create the circles.
Fromto
To fill a shape with circles, I have no idea.
JLG.
Copy link to clipboard
Copied
Thanks JLG for your reply, which is very helpful.
I just realize to address my 2nd question, basically I'm facing a 2D circle packing question, which is a NP hard question, and looks currently there is no elegant solution at AFAIK.
So I'm thinking about some alternatives, like to transform a shape into equally spaced contour lines (which ends in the boundary of a shape), then covert lines into circles. Then, my question becomes how to convert a shape into equally spaced contour lines?
Copy link to clipboard
Copied
Can you use a pattern brush and fill pattern? If I understand your problem correctly a brush would "replace a path" and a fill pattern would "fill a shape." You could create these assets in the document or perhaps have your plugin create them. Then have the plugin apply them to the path.
Copy link to clipboard
Copied
I periodically search for some sort of circle packing app or plugin for use with drawing and vector apps but have yet to find something that works directly with them. My current workaround is to import an image into my iPhone, use the Percolator app ( Percolator on the App Store ; Home: www.percolatorapp.com ) for circle packing, export back to my Mac, and then open and trace in AI. The results that I've gotten are pretty good. The main limitations are that the original image is limited in resolution as to what the iPhone/iPad accepts and I believe that Percolator might still be iOS-only. (I haven't seen anything similar for Android.)
Find more inspiration, events, and resources on the new Adobe Community
Explore Now