Copy link to clipboard
Copied
I'm trying to help a friend with a 3D project where the Illustrator object he is importing into his 3D program must consist of side-by-side anchor points instead of paths.
Explanation:
In this particular project, if an object has any paths between anchor points, the edge of the object will appear as invisible. So, the curves appear more solid because curves have more anchor points that straight paths.
I am aware that In Illustrator, one can click on Object/Path/Add Anchor Points to double the number of anchor points with each click.
This helps some but at a certain point, the number of anchor points in the curves and shorter paths are going increase so much that they begin to overlap each other while the longer paths will still have too few.
I was wondering it is possible to write a script to add anchor points to an object on any path until the path is completely filled with anchor points so that they are literally side-by-side but do not overlap.
I may be able to pay someone to create this script if the concept is doable.
ks
Copy link to clipboard
Copied
Maybe you can try this script written by kamiseto
Copy link to clipboard
Copied
This may help if I could understand the language. Any idea what the language is?
I was able to figure it out and it helps. That's for sure but it's not quite what I need.
Copy link to clipboard
Copied
Hi.
I recommend to read http://en.wikipedia.org/wiki/B%C3%A9zier_curve if you never read it.
below script is very basically thing to control bezier curves.
var tg = app.activeDocument.selection[0];
if (tg.typename=="PathItem" && tg.pathPoints.length==2){
var pt = new Array();
var nwPt = new Array();
var ratio = prompt ("ratio?", "0.5") - 0;
pt[0] = tg.pathPoints[0].anchor;
pt[1] = tg.pathPoints[0].rightDirection;
pt[2] = tg.pathPoints[1].leftDirection;
pt[3] = tg.pathPoints[1].anchor;
tg.pathPoints[0].rightDirection = linearSprit(pt[0], pt[1], ratio);
tg.pathPoints[1].leftDirection = linearSprit(pt[2], pt[3], ratio);
tg.pathPoints.add();
tg.pathPoints[2].leftDirection = linearSprit(pt[2], pt[3], ratio);
tg.pathPoints[2].anchor = pt[3];
tg.pathPoints[2].rightDirection = tg.pathPoints[1].rightDirection;
tg.pathPoints[1].anchor = nwAnchor (pt[0], pt[1], pt[2], pt[3], ratio);
tg.pathPoints[1].leftDirection = nwDirection (pt[0], pt[1], pt[2], ratio);
tg.pathPoints[1].rightDirection = nwDirection (pt[1], pt[2], pt[3], ratio);
}
function linearSprit (p0, p1, t) { //linear bezier
var dirPt = new Array();
for (var i=0;i<2;i++){
dirPt = p1 * t + p0 * (1 - t);
}
return dirPt;
}
function nwDirection(p0, p1, p2, t){ //quadratic bezier
var dirPt = new Array()
for (var i=0;i<2;i++){
dirPt = (Math.pow ((1 - t), 2) )* p0
+ 2 * (1 - t) * t * p1
+ t * t * p2 ;
}
return dirPt;
}
function nwAnchor(p0,p1,p2,p3, t){ //cublic bezier
var spPt = new Array()
for (var i=0;i<2;i++){
spPt = (Math.pow ((1 - t), 3)) * p0
+ 3 * (Math.pow ((1 - t), 2)) * t * p1
+ 3 * (Math.pow (t, 2)) * (1 - t) * p2
+ Math.pow (t, 3) * p3 ;
}
return spPt;
}
This script add anchor point to pair of selected anchor points.
Ten