construction: More sleevecap work
This commit is contained in:
parent
69f724faea
commit
36b1669583
6 changed files with 32 additions and 29 deletions
|
@ -17,7 +17,6 @@ export default {
|
||||||
options: [
|
options: [
|
||||||
// Constants
|
// Constants
|
||||||
{ id: "shoulderSlopeReduction", val: 0, type: "constant" },
|
{ id: "shoulderSlopeReduction", val: 0, type: "constant" },
|
||||||
{ id: "sleevecapEase", val: 5, type: "constant" },
|
|
||||||
{ id: "collarFactor", val: 4.8, type: "constant" },
|
{ id: "collarFactor", val: 4.8, type: "constant" },
|
||||||
|
|
||||||
// Measures
|
// Measures
|
||||||
|
@ -52,5 +51,6 @@ export default {
|
||||||
{ id: "sleevecapQ3Spread2", val: 8, type: "%", min: 0, max: 7 },
|
{ id: "sleevecapQ3Spread2", val: 8, type: "%", min: 0, max: 7 },
|
||||||
{ id: "sleevecapQ4Spread1", val: 7, type: "%", min: 0, max: 7 },
|
{ id: "sleevecapQ4Spread1", val: 7, type: "%", min: 0, max: 7 },
|
||||||
{ id: "sleevecapQ4Spread2", val: 7, type: "%", min: 0, max: 7 },
|
{ id: "sleevecapQ4Spread2", val: 7, type: "%", min: 0, max: 7 },
|
||||||
|
{ id: "sleevecapEase", val: 1, type: "%", min: 0, max: 10 },
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,9 +18,8 @@
|
||||||
var debug = {
|
var debug = {
|
||||||
name: 'debug',
|
name: 'debug',
|
||||||
hooks: {
|
hooks: {
|
||||||
debug: function debugPlugin(next, data) {
|
debug: function (next, d='',e='',b='',u='',g='') {
|
||||||
if(typeof data === 'string') console.log('%cDebug', 'color: #dd69dd', data);
|
console.log('%cDebug', 'color: #dd69dd; font-weight: bold', d,e,b,u,g);
|
||||||
else console.log(data);
|
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ var back = {
|
||||||
let part = new pattern.Part().copy(pattern.parts.base);
|
let part = new pattern.Part().copy(pattern.parts.base);
|
||||||
|
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
let {store, sa, Point, points, Path, paths, Snippet, snippets, final, paperless, macro} = freesewing.utils.shorthand(part);
|
let {store, sa, Point, points, Path, paths, Snippet, snippets, final, paperless, macro} = part.shorthand();
|
||||||
|
|
||||||
// Seamline
|
// Seamline
|
||||||
paths.seam = shared.seamLine("back", points, Path);
|
paths.seam = shared.seamLine("back", points, Path);
|
||||||
|
|
|
@ -6,7 +6,7 @@ var base = {
|
||||||
part.render = false;
|
part.render = false;
|
||||||
|
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
let {measurements, options, points, paths, snippets, Path, Point, Snippet, utils, final, paperless, sa, macro} = freesewing.utils.shorthand(part);
|
let {measurements, options, points, paths, snippets, Path, Point, Snippet, utils, final, paperless, sa, macro} = part.shorthand();
|
||||||
|
|
||||||
// Center back (cb) vertical axis
|
// Center back (cb) vertical axis
|
||||||
points.cbNeck = new Point(
|
points.cbNeck = new Point(
|
||||||
|
|
|
@ -7,7 +7,7 @@ var front = {
|
||||||
let part = new pattern.Part().copy(pattern.parts.back);
|
let part = new pattern.Part().copy(pattern.parts.back);
|
||||||
|
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
let {store, sa, Point, points, Path, paths, Snippet, snippets, options, measurements, final, paperless, macro} = freesewing.utils.shorthand(part);
|
let {store, sa, Point, points, Path, paths, Snippet, snippets, options, measurements, final, paperless, macro} = part.shorthand();
|
||||||
|
|
||||||
// Cut arm a bit deeper at the front
|
// Cut arm a bit deeper at the front
|
||||||
let deeper = measurements.chestCircumference * options.frontArmholeDeeper;
|
let deeper = measurements.chestCircumference * options.frontArmholeDeeper;
|
||||||
|
|
|
@ -1,26 +1,23 @@
|
||||||
import freesewing from "freesewing";
|
import freesewing from "freesewing";
|
||||||
|
|
||||||
|
/** Calculates the differece between actual and optimal sleevecap length
|
||||||
|
* Positive values mean sleevecap is longer than armhole
|
||||||
|
*/
|
||||||
function sleevecapDelta(store) {
|
function sleevecapDelta(store) {
|
||||||
// Positive values mean sleevecap is longer than armhole
|
return store.get("sleevecapLength") - store.get("sleevecapTarget");
|
||||||
return (
|
|
||||||
store.get("sleevecapLength") -
|
|
||||||
(store.get("frontArmholeLength") + store.get("backArmholeLength"))
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function sleevecapAdjust(store) {
|
function sleevecapAdjust(store) {
|
||||||
let delta = sleevecapDelta(store);
|
let delta = sleevecapDelta(store);
|
||||||
let factor = store.get("sleeveFactor");
|
let factor = store.get("sleeveFactor");
|
||||||
if (delta > 50) factor = factor * 0.95;
|
if (delta > 0) factor = factor * 0.98;
|
||||||
else if (delta > 0) factor = factor * 0.995;
|
else factor = factor * 1.02;
|
||||||
else if (delta < 50) factor = factor * 1.05;
|
|
||||||
else factor = factor * 1.005;
|
|
||||||
store.set("sleeveFactor", factor);
|
store.set("sleeveFactor", factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
function draftSleevecap(part) {
|
function draftSleevecap(part, run) {
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
let {debug, store, measurements, options, Point, points, Path, paths} = freesewing.utils.shorthand(part);
|
let {debug, units, store, measurements, options, Point, points, Path, paths} = part.shorthand();
|
||||||
// Sleeve center axis
|
// Sleeve center axis
|
||||||
points.centerCap = new Point(0, 0);
|
points.centerCap = new Point(0, 0);
|
||||||
points.centerWrist = new Point(
|
points.centerWrist = new Point(
|
||||||
|
@ -40,11 +37,6 @@ function draftSleevecap(part) {
|
||||||
((measurements.bicepsCircumference * (1 + options.bicepsEase)) / 2) *
|
((measurements.bicepsCircumference * (1 + options.bicepsEase)) / 2) *
|
||||||
store.get("sleeveFactor")
|
store.get("sleeveFactor")
|
||||||
);
|
);
|
||||||
// Make sure we draft a sleeve that fits the biceps
|
|
||||||
if (points.leftBiceps.x * -1 < measurements.bicepsCircumference / 1.95) {
|
|
||||||
points.leftBiceps.x = measurements.bicepsCircumference / 1.95;
|
|
||||||
part.debug("Warning: Forced sleeve to fit biceps");
|
|
||||||
}
|
|
||||||
points.rightBiceps = points.leftBiceps.flipX(points.centerBiceps);
|
points.rightBiceps = points.leftBiceps.flipX(points.centerBiceps);
|
||||||
|
|
||||||
// Pitch points
|
// Pitch points
|
||||||
|
@ -150,27 +142,39 @@ function draftSleevecap(part) {
|
||||||
.line(points.rightBiceps)
|
.line(points.rightBiceps)
|
||||||
.join(sleevecap, true);
|
.join(sleevecap, true);
|
||||||
|
|
||||||
|
// Uncomment this line to see all sleevecap iterations
|
||||||
|
//paths[run] = paths.seam;
|
||||||
|
|
||||||
// Store sleevecap length
|
// Store sleevecap length
|
||||||
store.set("sleevecapLength", sleevecap.length());
|
store.set("sleevecapLength", sleevecap.length());
|
||||||
|
if (run === 1) {
|
||||||
|
let armholeLength =
|
||||||
|
store.get("frontArmholeLength") + store.get("backArmholeLength");
|
||||||
|
let sleevecapEase = armholeLength * options.sleevecapEase;
|
||||||
|
store.set("sleevecapEase", sleevecapEase);
|
||||||
|
store.set("sleevecapTarget", armholeLength + sleevecapEase);
|
||||||
|
debug("Sleevecap ease is", units(sleevecapEase));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var sleeve = {
|
var sleeve = {
|
||||||
draft: function(pattern) {
|
draft: function(pattern) {
|
||||||
let part = new pattern.Part();
|
let part = new pattern.Part();
|
||||||
|
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
let {debug, store, sa, measurements, options, Point, points, Path, paths, Snippet, snippets, final, paperless, macro} = freesewing.utils.shorthand(part);
|
let {debug, store, units, sa, measurements, options, Point, points, Path, paths, Snippet, snippets, final, paperless, macro} = part.shorthand();
|
||||||
|
|
||||||
store.set("sleeveFactor", 1);
|
store.set("sleeveFactor", 1);
|
||||||
let run = 1;
|
let run = 1;
|
||||||
do {
|
do {
|
||||||
draftSleevecap(part);
|
draftSleevecap(part, run);
|
||||||
part.debug(
|
debug(
|
||||||
`Sleevecap draft ${run}, sleevecap delta is ${sleevecapDelta(store)}`
|
`Sleevecap draft ${run}, sleevecap delta is ${units(
|
||||||
|
sleevecapDelta(store)
|
||||||
|
)}`
|
||||||
);
|
);
|
||||||
sleevecapAdjust(store);
|
sleevecapAdjust(store);
|
||||||
run++;
|
run++;
|
||||||
} while (Math.abs(sleevecapDelta(store)) > 2 && run < 10);
|
} while (Math.abs(sleevecapDelta(store)) > 2 && run < 100);
|
||||||
|
|
||||||
// Anchor point for sampling
|
// Anchor point for sampling
|
||||||
points.gridAnchor = points.origin;
|
points.gridAnchor = points.origin;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue