Close Photoshop path without extra point
I wrote a script (years ago) to draw a circle using paths in Photoshop. It works!
However, the thing that it doesn't quite do properly is close the path - the start and end point just co-incide (which used to be the way paths were closed) I've tried messing around with the code the obvious choice woule be to so set closed to true:
lineSubPathArray[0].closed = true;
But that adds an extra point to the circle and closes it. see screen shot - I've move the extra point out the way so you can see it clearly.

I'm aiming for a closed, fourpoint circle. Here's my code:
function draw_circle(X, Y, rad, pathName, col)
{
var K = (4 * (Math.sqrt(2) - 1) / 3)* rad;
// define circle points
var C = new Array();
C = [X, Y - rad, X + rad, Y, X, Y + rad, X - rad, Y, X + K, Y - rad, X + rad, Y - K, X + rad, Y + K, X - K, Y + rad, X + K, Y + rad, X - rad, Y + K, X - rad, Y - K, X - K, Y - rad];
// create the array of PathPointInfo objects
var lineArray = new Array();
lineArray.push(new PathPointInfo());
lineArray[0].kind = PointKind.CORNERPOINT;
lineArray[0].anchor = new Array(C[0], C[1]); // A
lineArray[0].leftDirection = [C[8], C[9]];
lineArray[0].rightDirection = lineArray[0].anchor;
lineArray.push(new PathPointInfo());
lineArray[1].kind = PointKind.CORNERPOINT;
lineArray[1].anchor = new Array(C[2], C[3]); // B
lineArray[1].leftDirection = [C[12], C[13]];
lineArray[1].rightDirection = [C[10], C[11]];
lineArray.push(new PathPointInfo());
lineArray[2].kind = PointKind.CORNERPOINT;
lineArray[2].anchor = new Array(C[4], C[5]); // C
lineArray[2].leftDirection = [C[14], C[15]];
lineArray[2].rightDirection = [C[16], C[17]];
lineArray.push(new PathPointInfo());
lineArray[3].kind = PointKind.CORNERPOINT;
lineArray[3].anchor = new Array(C[6], C[7]); // D
lineArray[3].leftDirection = [C[20], C[21]];
lineArray[3].rightDirection = [C[18], C[19]];
lineArray.push(new PathPointInfo());
lineArray[4].kind = PointKind.CORNERPOINT;
lineArray[4].anchor = new Array(C[0], C[1]);
lineArray[4].leftDirection = lineArray[4].anchor;
lineArray[4].rightDirection = [C[22], C[23]];
// create a SubPathInfo object, which holds the line array in its entireSubPath property.
var lineSubPathArray = new Array();
lineSubPathArray.push(new SubPathInfo());
lineSubPathArray[0].operation = ShapeOperation.SHAPEXOR;
lineSubPathArray[0].closed = false;
lineSubPathArray[0].entireSubPath = lineArray;
//create the path item, passing subpath to add method
var myPathItem = docRef.pathItems.add(pathName, lineSubPathArray);
}
