I am trying to find points for the curve between two points
These are my two points in x,z planes
startPoint = new THREE.Vector3(1042.3745025363808, 0, -3017.6896180088434)
endPoint = new THREE.Vector3(1042.3575319644679, 0, -3017.6726474369307)
var vertex, i,
center, p0, p1, angle,
radius, startAngle,
thetaAngle;
THREE.Geometry.call(this);
this.startPoint = p0 = startPoint ? new THREE.Vector2(startPoint.x, startPoint.y) : new THREE.Vector2(0, 0);
this.endPoint = p1 = endPoint ? new THREE.Vector2(endPoint.x, endPoint.y) : new THREE.Vector2(1, 0);
this.bulge = bulge = bulge || 1;
angle = 4 * Math.atan(bulge);
radius = p0.distanceTo(p1) / 2 / Math.sin(angle / 2);
center = THREEx.Math.polar(startPoint, radius, THREEx.Math.angle2(p0, p1) + (Math.PI / 2 - angle / 2));
this.segments = segments = segments || Math.max(Math.abs(Math.ceil(angle / (Math.PI / 18))), 6); // By default want a segment roughly every 10 degrees
startAngle = THREEx.Math.angle2(center, p0);
thetaAngle = angle / segments;
this.vertices.push(new THREE.Vector3(p0.x ? p0.x : 0, p0.y ? p0.y : 0, 0));
for (i = 1; i <= segments - 1; i++) {
vertex = THREEx.Math.polar(center, Math.abs(radius), startAngle + thetaAngle * i);
this.vertices.push(new THREE.Vector3(vertex.x ? vertex.x : 0, vertex.y ? vertex.y : 0, 0));
}
bulge - a value indicating how much to curve
bulge = -0.4142135623726088
Here it looks like this formula is for x,y plane but my geometries are in x.z plane
THREEx.Math.polar = function (point, distance, angle) {
var result = {};
result.x = point.x + distance * Math.cos(angle);
result.y = point.y + distance * Math.sin(angle);
return result;
};
THREEx.Math.angle2 = function (p1, p2) {
var v1 = new THREE.Vector2(p1.x, p1.y);
var v2 = new THREE.Vector2(p2.x, p2.y);
v2.sub(v1); // sets v2 to be our chord
v2.normalize();
if (v2.y < 0) return -Math.acos(v2.x);
return Math.acos(v2.x);
};
Please let me know if its possible