I'm trying to merge two meshes together by creating a third intermediate bridging mesh.

The script returns the message 'Neither ours and theirs is supplied, this function will fallback to combine', but as far as I can see both meshes are supplied exactly as the example in the library.

A snippet of the code:

var innerMesh = drawCurveMesh(origin, {x: 20, y:0}, curveAngle, 3, 0.8, 3.2);

var innerUpperMesh = drawCurveMesh(origin, {x: 20, y:0}, curveAngle, 1.25, 4.4, 5.2);

var ilb = innerMesh.boundaries();

var iub = innerUpperMesh.boundaries();

innerMesh.combineByBoundaries(innerUpperMesh, {ours: ilb, theirs: iub});

And the function drawCurveMesh:

function drawCurveMesh(origin, offset, angle, width, height, bottom){

var curPath = new Path2D();

var rightTurn = (origin.x > offset.x ? 1 : -1);

var ics = {x: offset.x + (rightTurn * width), y: offset.y};

var ocs = {x: offset.x + (rightTurn * width * -1), y: offset.y};

var innerCurve = {start: ics,

control: rotate2DPoint(ics, origin, -angle/2),

end: rotate2DPoint(ics, origin, -angle)};

var outerCurve = {start: ocs,

control: rotate2DPoint(ocs, origin, -angle/2),

end: rotate2DPoint(ocs, origin, -angle)};

curPath.moveTo(innerCurve.start.x, innerCurve.start.y);

curPath.quadraticCurveTo(innerCurve.control.x, innerCurve.control.y, innerCurve.end.x, innerCurve.end.y);

curPath.lineTo(outerCurve.end.x, outerCurve.end.y);

curPath.quadraticCurveTo(outerCurve.control.x, outerCurve.control.y, outerCurve.start.x, outerCurve.start.y);

curPath.close();

return raiseMesh(Solid.extrude([curPath], height).mesh, bottom);

}

function rotate2DPoint(point, origin, angle){

var angleRad = angle * Math.PI / 180.0;

var newX = Math.cos(angleRad) * (point.x - origin.x) - Math.sin(angleRad) * (point.y - origin.y) + origin.x;

var newY = Math.sin(angleRad) * (point.x - origin.x) + Math.cos(angleRad) * (point.y - origin.y) + origin.y;

return {

x: newX,

y: newY

};

}

Without the combineByBoundaries() this script creates the curves separately and does so exactly like I need them to.