From 44660ed9dbfb65e74c05b84078eb9ac5f58b00c5 Mon Sep 17 00:00:00 2001 From: Joost De Cock Date: Thu, 20 Feb 2020 13:53:21 +0100 Subject: [PATCH] chore: Changed neckstimate calculations and menswear base --- packages/utils/src/neckstimate/index.js | 5 +- packages/utils/src/neckstimate/ratio.js | 38 ++++++++++++++ .../utils/src/neckstimate/without-breasts.js | 49 +++++++++---------- 3 files changed, 66 insertions(+), 26 deletions(-) create mode 100644 packages/utils/src/neckstimate/ratio.js diff --git a/packages/utils/src/neckstimate/index.js b/packages/utils/src/neckstimate/index.js index fba9501bda8..1ba3c80a13a 100644 --- a/packages/utils/src/neckstimate/index.js +++ b/packages/utils/src/neckstimate/index.js @@ -1,5 +1,6 @@ import withBreasts from './with-breasts' import withoutBreasts from './without-breasts' +import ratio from './ratio' // This estimates a measurement based on the neck circumference const neckstimate = (neckCircumference = false, measurement = false, breasts = false) => { @@ -24,7 +25,9 @@ const neckstimate = (neckCircumference = false, measurement = false, breasts = f } // This is what should happen - return neckCircumference * (data[measurement] / data.neckCircumference) + let delta = (neckCircumference / data.neckCircumference) * data[measurement] - data[measurement] + + return data[measurement] + delta * ratio[measurement] } export default neckstimate diff --git a/packages/utils/src/neckstimate/ratio.js b/packages/utils/src/neckstimate/ratio.js new file mode 100644 index 00000000000..4f02eafad2c --- /dev/null +++ b/packages/utils/src/neckstimate/ratio.js @@ -0,0 +1,38 @@ +/* + * Since linear measurements don't scale the same as circumference + * measurements, we apply a correction ratio. + */ + +export default { + ankleCircumference: 1, + bicepsCircumference: 1, + bustFront: 0.5, + bustSpan: 0.5, + chestCircumference: 1, + headCircumference: 1, + highBust: 1, + highBustFront: 0.5, + hipsCircumference: 1, + hipsToUpperLeg: 0.5, + hpsToBust: 0.5, + hpsToHipsBack: 0.5, + hpsToHipsFront: 0.5, + inseam: 0.5, + kneeCircumference: 1, + naturalWaist: 1, + naturalWaistToFloor: 0.5, + naturalWaistToHip: 0.5, + naturalWaistToKnee: 0.5, + naturalWaistToSeat: 0.5, + naturalWaistToUnderbust: 0.5, + neckCircumference: 1, + seatCircumference: 1, + seatDepth: 0.5, + shoulderSlope: 0.5, + shoulderToElbow: 0.5, + shoulderToShoulder: 0.5, + shoulderToWrist: 0.5, + underbust: 1, + upperLegCircumference: 1, + wristCircumference: 1 +} diff --git a/packages/utils/src/neckstimate/without-breasts.js b/packages/utils/src/neckstimate/without-breasts.js index 006f7004dd9..c392dcacd4c 100644 --- a/packages/utils/src/neckstimate/without-breasts.js +++ b/packages/utils/src/neckstimate/without-breasts.js @@ -1,34 +1,33 @@ /* - * These are a set of measurements of an average-sized woman. + * These are a set of measurements of an average-sized man. * We simply extrapolate for other sizes (based on neckCircumference) * by keeping the same proportions. * That is almost certainly not the best sizing table you can get, * but we are not in the business of standard sizes, so this will do. */ export default { - ankleCircumference: 256, - bicepsCircumference: 325, - chestCircumference: 1040, - headCircumference: 579, - hipsCircumference: 920, - hipsToUpperLeg: 220, - hpsToBust: 275, - hpsToHipsBack: 690, - hpsToHipsFront: 635, - inseam: 859, + ankleCircumference: 235, + bicepsCircumference: 350, + chestCircumference: 1000, + headCircumference: 590, + hipsCircumference: 840, + hipsToUpperLeg: 210, + hpsToBust: 28, + hpsToHipsBack: 600, + inseam: 780, kneeCircumference: 410, - naturalWaist: 880, - naturalWaistToFloor: 1300, - naturalWaistToHip: 180, - naturalWaistToKnee: 580, - naturalWaistToSeat: 280, - neckCircumference: 420, - seatCircumference: 1060, - seatDepth: 380, - shoulderSlope: 690, - shoulderToElbow: 345, - shoulderToShoulder: 460, - shoulderToWrist: 640, - upperLegCircumference: 599, - wristCircumference: 180 + naturalWaist: 810, + naturalWaistToFloor: 1160, + naturalWaistToHip: 130, + naturalWaistToKnee: 640, + naturalWaistToSeat: 270, + neckCircumference: 380, + seatCircumference: 1020, + seatDepth: 210, + shoulderSlope: 585, + shoulderToElbow: 36, + shoulderToShoulder: 450, + shoulderToWrist: 630, + upperLegCircumference: 625, + wristCircumference: 175 }