2018-12-20 08:32:21 +01:00
|
|
|
export default function(part) {
|
|
|
|
// prettier-ignore
|
|
|
|
let {measurements, options, store, points, snippets, paths, Point, Snippet, Path, utils, complete, debug } = part.shorthand();
|
2018-09-11 16:26:38 +02:00
|
|
|
|
2018-12-20 08:32:21 +01:00
|
|
|
// Where to divide our corset into panels
|
|
|
|
if (options.panels === 11) store.set('gaps', [0.15,0.275,0.4,0.6,0.75]);
|
|
|
|
else store.set('gaps', [0.2,0.35,0.5,0.65,0.8]);
|
2018-09-11 16:26:38 +02:00
|
|
|
|
2018-12-20 08:32:21 +01:00
|
|
|
// Absolute values for some options
|
|
|
|
store.set('waistReduction', measurements.naturalWaist * options.waistReduction);
|
|
|
|
debug({
|
|
|
|
type: "info",
|
|
|
|
label: '✅ Waist reduction',
|
|
|
|
msg: utils.units(store.get('waistReduction'))
|
|
|
|
});
|
|
|
|
store.set('backOpening', measurements.underbust * options.backOpening);
|
|
|
|
debug({
|
|
|
|
type: "info",
|
|
|
|
label: '✅ Back opening',
|
|
|
|
msg: utils.units(store.get('backOpening'))
|
|
|
|
});
|
|
|
|
let len = measurements.naturalWaistToUnderbust + measurements.naturalWaistToHip;
|
|
|
|
for(let option of ['backRise', 'backDrop', 'frontRise', 'frontDrop', 'hipRise'])
|
|
|
|
store.set(option, len * options[option]);
|
|
|
|
store.set('length', len);
|
2018-09-11 16:26:38 +02:00
|
|
|
|
2018-12-20 08:32:21 +01:00
|
|
|
/**
|
|
|
|
* How much should we take in the corset at waist and bust
|
|
|
|
*
|
|
|
|
* I assume that the hips are larger than the underbust.
|
|
|
|
* Can I be sure? Maybe not, but a larger underbust than hip
|
|
|
|
* measurements seems very rare to say the least.
|
|
|
|
*/
|
|
|
|
store.set('width', 0.5 * (
|
|
|
|
measurements.hipsCircumference -
|
|
|
|
store.get('backOpening')
|
|
|
|
));
|
|
|
|
store.set('waistIntake', 0.5 * (
|
|
|
|
measurements.hipsCircumference -
|
|
|
|
measurements.naturalWaist +
|
|
|
|
store.get('waistReduction')
|
|
|
|
));
|
|
|
|
store.set('bustIntake', 0.5 * (
|
|
|
|
measurements.hipsCircumference -
|
|
|
|
measurements.underbust
|
|
|
|
));
|
2018-09-11 16:26:38 +02:00
|
|
|
|
2018-12-20 08:32:21 +01:00
|
|
|
// Basic box (CB = Center back, CF = Center front)
|
|
|
|
let wid = store.get('width');
|
|
|
|
points.underbustCF = new Point(0,0);
|
|
|
|
points.hipsCF = new Point(0, len);
|
|
|
|
points.hipsCB = new Point(wid, len);
|
|
|
|
points.underbustCB = new Point(wid , 0);
|
|
|
|
points.topSide = points.underbustCF.shiftFractionTowards(points.underbustCB, 0.5);
|
|
|
|
points.bottomSide = points.hipsCF.shiftFractionTowards(points.hipsCB, 0.5);
|
|
|
|
points.waistCF = points.underbustCF.shift(-90, measurements.naturalWaistToUnderbust);
|
|
|
|
points.waistCB = new Point(points.hipsCB.x, points.waistCF.y);
|
2018-09-11 16:26:38 +02:00
|
|
|
|
2018-12-20 08:32:21 +01:00
|
|
|
// frontRise
|
|
|
|
points.topCF = points.underbustCF.shift(90, store.get('frontRise'));
|
|
|
|
points.frontRiseStart = points.underbustCF.shift(0, wid * 0.15);
|
|
|
|
points.frontRiseStartCp2 = points.underbustCF.shift(0, wid * 0.11);
|
|
|
|
points.topCFCp1 = points.topCF.shift(0, wid * 0.11);
|
2018-09-11 16:26:38 +02:00
|
|
|
|
2018-12-20 08:32:21 +01:00
|
|
|
// frontDrop
|
|
|
|
points.bottomCF = points.hipsCF.shift(-90, store.get('frontDrop'));
|
|
|
|
points.bottomCFCp2 = points.bottomCF.shift(0, wid * 0.11);
|
2018-09-11 16:26:38 +02:00
|
|
|
|
2018-12-20 08:32:21 +01:00
|
|
|
// hipRise
|
|
|
|
points.hipRise = points.bottomSide.shift(90, store.get('hipRise'));
|
|
|
|
points.hipRiseCp1 = points.hipRise.shift(180, wid * 0.3);
|
|
|
|
points.hipRiseCp2 = points.hipRise.shift(0, wid * 0.2);
|
2018-09-11 16:26:38 +02:00
|
|
|
|
2018-12-20 08:32:21 +01:00
|
|
|
// backDrop
|
|
|
|
points.backDrop = points.hipsCB.shift(-90, store.get('backDrop'));
|
|
|
|
points.backDropCp1 = points.backDrop.shift(180, wid * 0.3);
|
2018-09-11 16:26:38 +02:00
|
|
|
|
2018-12-20 08:32:21 +01:00
|
|
|
// backRise
|
|
|
|
points.backRise = points.underbustCB.shift(90, store.get('backRise'));
|
|
|
|
points.backRiseCp1 = points.backRise.shift(180, wid * 0.4);
|
|
|
|
points.topSideCp1 = points.topSide.shift(0, wid * 0.2);
|
2018-09-11 16:26:38 +02:00
|
|
|
|
2018-12-20 08:32:21 +01:00
|
|
|
// Paths
|
|
|
|
paths.help1 = new Path()
|
|
|
|
.move(points.underbustCF)
|
|
|
|
.line(points.hipsCF)
|
|
|
|
.line(points.hipsCB)
|
|
|
|
.line(points.underbustCB)
|
|
|
|
.close();
|
|
|
|
paths.help2 = new Path()
|
|
|
|
.move(points.topSide)
|
|
|
|
.line(points.bottomSide)
|
|
|
|
.line(points.waistCF)
|
|
|
|
.line(points.waistCB);
|
|
|
|
paths.help1.render = false;
|
|
|
|
paths.help2.render = false;
|
2018-09-11 16:26:38 +02:00
|
|
|
|
2018-12-20 08:32:21 +01:00
|
|
|
paths.outline = new Path()
|
|
|
|
.move(points.bottomCF)
|
|
|
|
.curve(points.bottomCFCp2, points.hipRiseCp1, points.hipRise)
|
|
|
|
.curve(points.hipRiseCp2, points.backDropCp1, points.backDrop)
|
|
|
|
.line(points.backRise)
|
|
|
|
.curve(points.backRiseCp1, points.topSideCp1, points.topSide)
|
|
|
|
.line(points.frontRiseStart)
|
|
|
|
.curve(points.frontRiseStartCp2, points.topCFCp1, points.topCF)
|
|
|
|
.line(points.bottomCF)
|
|
|
|
.close();
|
2018-09-11 16:26:38 +02:00
|
|
|
|
2018-12-20 08:32:21 +01:00
|
|
|
return part;
|
2018-09-11 16:26:38 +02:00
|
|
|
};
|