IE6 FIX
Hey all,
I've got another question. I'm trying to offset points from a path, with an equal distance from the path. To accomplish this I need to know the angle(direction) of the point. Is there an easy way to get to know this? I do think it's possible to get to know the direction, by measuring the distance between two points that are very close together, but I was wondering if there is an easier (better) way. I've attached an image.
Thanks in advance!
Thijs.
I've got another question. I'm trying to offset points from a path, with an equal distance from the path. To accomplish this I need to know the angle(direction) of the point. Is there an easy way to get to know this? I do think it's possible to get to know the direction, by measuring the distance between two points that are very close together, but I was wondering if there is an easier (better) way. I've attached an image.
Thanks in advance!
Thijs.
IE6 FIX
the Stitch-script on this site uses getNormal() and normalize() for this.
example:
example:
var art = new Path();
art.moveTo(500,500);
art.curveTo(500,250,250,500,250,500);
var art_copy = art.clone();
art_copy.curvesToPoints(50);
/*
curvesToPoints() used for this example,
but this doesn't give you a nice distribution
of points along the path.
*/
var count = art_copy.curves.length;
for (var k = 0; k < count; k++) {
var res = new Path();
var bezier = art_copy.curves[k];
var pt = bezier.getPoint(0);
res.moveTo(pt);
var n = bezier.getNormal(0).normalize(10);
// normalize(10) = offset from shape : 10 pts
if(n.x != 0 || n.y != 0){
res.segments.add(pt.add(n));
}
}
art_copy.remove();
activeDocument.redraw();
Scripts
13.10.08, 01:28
03.10.08, 00:01
18.09.08, 20:43
16.09.08, 21:36
14.09.08, 18:50
Posts
03.01.09, 20:57
02.01.09, 20:40
29.12.08, 18:05
29.12.08, 10:20
27.12.08, 14:28
Script of the Moment
Donation