Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function Honeycomb(hexWidth, margin, xcount, ycount) {
var hex = new m.models.Polygon(6, hexWidth / 2, 30, true);
this.models = {
honeycomb: m.layout.cloneToHoneycomb(hex, xcount, ycount, margin)
};
}
function WindowArchGrid(width, height, rows, columns, extra, split, spacing, fillet, outerFrame, outerFrameWidth) {
var column = (width - (columns - 1) * spacing) / columns;
var row = (height - (rows) * spacing + spacing / 2) / rows;
var cell = new makerjs.models.RoundRectangle(column, row, fillet);
var grid = makerjs.layout.cloneToGrid(cell, columns, rows, spacing);
makerjs.model.center(grid, true, false);
grid.origin[1] = -height;
this.models = {
arch: new WindowArch(width, columns, extra, split, spacing, fillet),
grid: grid
};
if (outerFrame) {
var frame = new makerjs.models.Dome(width + 2 * outerFrameWidth, height + width / 2 + 2 * outerFrameWidth);
frame.origin = [0, -height - outerFrameWidth];
this.models.frame = frame;
}
}
function TongueAndGroove(count, tongueWidth, grooveWidth, grooveDepth, radius, style) {
//Tongue and grooves for a box joint
var groove = new m.models.Dogbone(grooveWidth, grooveDepth, radius, style, true);
groove.paths.leftTongue = new m.paths.Line([-tongueWidth / 2, 0], [0, 0]);
groove.paths.rightTongue = new m.paths.Line([grooveWidth, 0], [grooveWidth + tongueWidth / 2, 0]);
this.models = {
tng: m.layout.cloneToRow(groove, count)
};
this.origin = [tongueWidth / 2, 0];
}
function FishScales(radius, sweep, xcount, ycount, expand, expansion) {
var s2 = sweep / 2;
var arc = new m.paths.Arc([0, 0], radius, 90 - s2, 90 + s2);
this.models = {
scales: m.layout.cloneToBrick(arc, xcount, ycount)
};
if (expand) {
this.models.scales = m.model.expandPaths(this, expansion);
}
}
function TongueAndGroove(count, tongueWidth, grooveWidth, grooveDepth, dogbone) {
//Tongue and grooves for a box joint
var groove = new m.models.Dogbone(grooveWidth, grooveDepth, dogbone, 0, true);
groove.paths.leftTongue = new m.paths.Line([-tongueWidth / 2, 0], [0, 0]);
groove.paths.rightTongue = new m.paths.Line([grooveWidth, 0], [grooveWidth + tongueWidth / 2, 0]);
this.models = {
tng: m.layout.cloneToRow(groove, count)
};
this.origin = [tongueWidth / 2, 0];
}
function TextOnPath(font, fontSize, topText, topSpan, bottomText, bottomSpan, baseline, contain, rotate, showPath) {
var topTextModel = new makerjs.models.Text(font, topText, fontSize);
var bottomTextModel = new makerjs.models.Text(font, bottomText, fontSize);
var topArc = new makerjs.paths.Arc([0, 0], 100, 90 - topSpan / 2, 90 + topSpan / 2);
var bottomArc = new makerjs.paths.Arc([0, 0], 100, 270 - bottomSpan / 2, 270 + bottomSpan / 2);
makerjs.layout.childrenOnPath(topTextModel, topArc, baseline, true, contain, rotate);
makerjs.layout.childrenOnPath(bottomTextModel, bottomArc, baseline, false, contain, rotate);
this.models = {
topText: topTextModel,
bottomText: bottomTextModel
};
if (showPath) {
this.paths = {
topArc: topArc,
bottomArc: bottomArc
};
}
}
function TextOnChain(font, text, fontSize, baseline, reversed, contain, rotate, svgPathData, showPath) {
var textModel = new makerjs.models.Text(font, text, fontSize);
var svgPath = makerjs.importer.fromSVGPathData(svgPathData);
var chain = makerjs.model.findSingleChain(svgPath);
makerjs.layout.childrenOnChain(textModel, chain, baseline, reversed, contain, rotate);
this.models = {
text: textModel
};
if (showPath) {
this.models.svgPath = svgPath;
}
}
function TextOnPath(font, fontSize, topText, topSpan, bottomText, bottomSpan, baseline, contain, rotate, showPath) {
var topTextModel = new makerjs.models.Text(font, topText, fontSize);
var bottomTextModel = new makerjs.models.Text(font, bottomText, fontSize);
var topArc = new makerjs.paths.Arc([0, 0], 100, 90 - topSpan / 2, 90 + topSpan / 2);
var bottomArc = new makerjs.paths.Arc([0, 0], 100, 270 - bottomSpan / 2, 270 + bottomSpan / 2);
makerjs.layout.childrenOnPath(topTextModel, topArc, baseline, true, contain, rotate);
makerjs.layout.childrenOnPath(bottomTextModel, bottomArc, baseline, false, contain, rotate);
this.models = {
topText: topTextModel,
bottomText: bottomTextModel
};
if (showPath) {
this.paths = {
topArc: topArc,
bottomArc: bottomArc
};
}
}