1
0
Fork 0

chore(simon): Ported simon to new measurements. See #416

This commit is contained in:
Joost De Cock 2020-06-07 14:36:19 +02:00
parent 6170b8cf40
commit ae5bd9d843
4 changed files with 20 additions and 29 deletions

View file

@ -104,9 +104,9 @@ export default {
measurements: [ measurements: [
'bicepsCircumference', 'bicepsCircumference',
'chestCircumference', 'chestCircumference',
'hpsToHipsBack', 'hpsToWaistBack',
'naturalWaist', 'waistCircumference',
'naturalWaistToHip', 'waistToHips',
'neckCircumference', 'neckCircumference',
'shoulderSlope', 'shoulderSlope',
'shoulderToShoulder', 'shoulderToShoulder',

View file

@ -1,6 +1,6 @@
import { calculateReduction } from './shared' import { calculateReduction } from './shared'
export default part => { export default (part) => {
part.paths = {} // Removes paperless dimensions from brian part.paths = {} // Removes paperless dimensions from brian
let { let {
store, store,
@ -43,7 +43,7 @@ export default part => {
points.waist = points.waist.shift(180, nonDarts) points.waist = points.waist.shift(180, nonDarts)
points.dartCenter = points.cbWaist.shiftFractionTowards(points.waist, 0.6) points.dartCenter = points.cbWaist.shiftFractionTowards(points.waist, 0.6)
points.dartTop = points.dartCenter.shift(90, points.armhole.dy(points.waist) * 0.75) points.dartTop = points.dartCenter.shift(90, points.armhole.dy(points.waist) * 0.75)
points.dartBottom = points.dartCenter.shift(-90, measurements.naturalWaistToHip * 0.75) points.dartBottom = points.dartCenter.shift(-90, measurements.waistToHips * 0.75)
points.dartCenterIn = points.dartCenter.shift(180, darts) points.dartCenterIn = points.dartCenter.shift(180, darts)
points.dartCenterOut = points.dartCenter.shift(0, darts) points.dartCenterOut = points.dartCenter.shift(0, darts)
points.dartCenterInCp1 = points.dartCenterIn.shift( points.dartCenterInCp1 = points.dartCenterIn.shift(
@ -74,7 +74,7 @@ export default part => {
// No darts in the back // No darts in the back
points.waist = points.waist.shift(180, reduce / 4) points.waist = points.waist.shift(180, reduce / 4)
} }
points.waistCp1 = points.waist.shift(-90, measurements.naturalWaistToHip * 0.5) points.waistCp1 = points.waist.shift(-90, measurements.waistToHips * 0.5)
points.waistCp2 = points.waist.shift(90, points.armhole.dy(points.waist) / 2) points.waistCp2 = points.waist.shift(90, points.armhole.dy(points.waist) / 2)
points.hipsCp2 = points.hips.shift(90, points.waist.dy(points.hips) / 4) points.hipsCp2 = points.hips.shift(90, points.waist.dy(points.hips) / 4)
@ -192,10 +192,7 @@ export default part => {
// Paths // Paths
paths.saBase.render = false paths.saBase.render = false
paths.hemBase.render = false paths.hemBase.render = false
paths.seam = paths.hemBase paths.seam = paths.hemBase.join(paths.saBase).close().attr('class', 'fabric')
.join(paths.saBase)
.close()
.attr('class', 'fabric')
// Complete pattern? // Complete pattern?
if (complete) { if (complete) {

View file

@ -1,6 +1,6 @@
import { calculateReduction } from './shared' import { calculateReduction } from './shared'
export default part => { export default (part) => {
part.paths = {} part.paths = {}
let { let {
store, store,
@ -36,7 +36,7 @@ export default part => {
if (store.get('backDarts')) reduce = (reduce * (1 - options.backDartShaping)) / 4 if (store.get('backDarts')) reduce = (reduce * (1 - options.backDartShaping)) / 4
else reduce = reduce / 4 else reduce = reduce / 4
points.waist = points.waist.shift(180, reduce) points.waist = points.waist.shift(180, reduce)
points.waistCp1 = points.waist.shift(-90, measurements.naturalWaistToHip * 0.5) points.waistCp1 = points.waist.shift(-90, measurements.waistToHips * 0.5)
points.waistCp2 = points.waist.shift(90, points.armhole.dy(points.waist) / 2) points.waistCp2 = points.waist.shift(90, points.armhole.dy(points.waist) / 2)
points.hipsCp2 = points.hips.shift(90, points.waist.dy(points.hips) / 4) points.hipsCp2 = points.hips.shift(90, points.waist.dy(points.hips) / 4)
@ -65,10 +65,7 @@ export default part => {
points.bballEnd = points.hem.shiftFractionTowards(points.hips, options.hemCurve) points.bballEnd = points.hem.shiftFractionTowards(points.hips, options.hemCurve)
points.bballCp1 = points.bballStart.shiftFractionTowards(points.hem, 0.5) points.bballCp1 = points.bballStart.shiftFractionTowards(points.hem, 0.5)
points.bballCp2 = new Point(points.bballCp1.x, points.bballEnd.y) points.bballCp2 = new Point(points.bballCp1.x, points.bballEnd.y)
paths.saBase = new Path() paths.saBase = new Path().move(points.bballEnd).line(points.hips).join(paths.saBaseFromHips)
.move(points.bballEnd)
.line(points.hips)
.join(paths.saBaseFromHips)
paths.hemBase = new Path() paths.hemBase = new Path()
.move(points.cfHem) .move(points.cfHem)
.line(points.bballStart) .line(points.bballStart)
@ -89,10 +86,7 @@ export default part => {
.curve(points.slashCp2, points.slashCp1, points.slashStart) .curve(points.slashCp2, points.slashCp1, points.slashStart)
break break
default: default:
paths.saBase = new Path() paths.saBase = new Path().move(points.hem).line(points.hips).join(paths.saBaseFromHips)
.move(points.hem)
.line(points.hips)
.join(paths.saBaseFromHips)
paths.hemBase = new Path().move(points.cfHem).line(points.hem) paths.hemBase = new Path().move(points.cfHem).line(points.hem)
} }

View file

@ -1,7 +1,7 @@
export const calculateReduction = function(part) { export const calculateReduction = function (part) {
let { store, measurements, options } = part.shorthand() let { store, measurements, options } = part.shorthand()
let chest = measurements.chestCircumference * (1 + options.chestEase) let chest = measurements.chestCircumference * (1 + options.chestEase)
let waist = measurements.naturalWaist * (1 + options.waistEase) let waist = measurements.waistCircumference * (1 + options.waistEase)
let hips = measurements.hipsCircumference * (1 + options.hipsEase) let hips = measurements.hipsCircumference * (1 + options.hipsEase)
let waistReduction = chest - waist let waistReduction = chest - waist
let hipsReduction = chest - hips let hipsReduction = chest - hips
@ -25,7 +25,7 @@ export const calculateReduction = function(part) {
else store.set('backDarts', true) else store.set('backDarts', true)
} }
export const addButtons = function(part, origin = 'cfNeck', snippet = 'button') { export const addButtons = function (part, origin = 'cfNeck', snippet = 'button') {
let { points, options, snippets, Snippet } = part.shorthand() let { points, options, snippets, Snippet } = part.shorthand()
let len = points.cfNeck.dist(points.cfHips) * (1 - options.buttonFreeLength) let len = points.cfNeck.dist(points.cfHips) * (1 - options.buttonFreeLength)
for (let i = 1; i <= options.buttons; i++) { for (let i = 1; i <= options.buttons; i++) {
@ -41,7 +41,7 @@ export const addButtons = function(part, origin = 'cfNeck', snippet = 'button')
export const addButtonHoles = (part, origin) => addButtons(part, origin, 'buttonhole') export const addButtonHoles = (part, origin) => addButtons(part, origin, 'buttonhole')
export const draftBarrelCuff = part => { export const draftBarrelCuff = (part) => {
let { store, points, measurements, options, Point } = part.shorthand() let { store, points, measurements, options, Point } = part.shorthand()
let height = measurements.shoulderToWrist * options.cuffLength let height = measurements.shoulderToWrist * options.cuffLength
let width = measurements.wristCircumference * (1 + options.cuffEase + options.cuffOverlap) let width = measurements.wristCircumference * (1 + options.cuffEase + options.cuffOverlap)
@ -54,7 +54,7 @@ export const draftBarrelCuff = part => {
return part return part
} }
export const decorateBarrelCuff = part => { export const decorateBarrelCuff = (part) => {
let { macro, snippets, Snippet, points, measurements, options, Point } = part.shorthand() let { macro, snippets, Snippet, points, measurements, options, Point } = part.shorthand()
// Title // Title
points.title = new Point(points.bottomRight.x / 2, points.bottomRight.y / 2) points.title = new Point(points.bottomRight.x / 2, points.bottomRight.y / 2)
@ -92,7 +92,7 @@ export const decorateBarrelCuff = part => {
return part return part
} }
export const draftFrenchCuff = part => { export const draftFrenchCuff = (part) => {
let { store, points, measurements, options, Point } = part.shorthand() let { store, points, measurements, options, Point } = part.shorthand()
let margin = measurements.wristCircumference * options.cuffOverlap let margin = measurements.wristCircumference * options.cuffOverlap
let height = measurements.shoulderToWrist * options.cuffLength let height = measurements.shoulderToWrist * options.cuffLength
@ -111,7 +111,7 @@ export const draftFrenchCuff = part => {
return part return part
} }
export const decorateFrenchCuff = part => { export const decorateFrenchCuff = (part) => {
let { macro, snippets, Snippet, points, measurements, options, Point } = part.shorthand() let { macro, snippets, Snippet, points, measurements, options, Point } = part.shorthand()
// Title // Title
points.title = new Point(points.bottomRight.x / 2, points.bottomRight.y / 2) points.title = new Point(points.bottomRight.x / 2, points.bottomRight.y / 2)
@ -141,7 +141,7 @@ export const decorateFrenchCuff = part => {
return part return part
} }
export const paperlessBarrelCuff = part => { export const paperlessBarrelCuff = (part) => {
let { sa, macro, points, options } = part.shorthand() let { sa, macro, points, options } = part.shorthand()
macro('hd', { macro('hd', {
from: points.buttonhole1, from: points.buttonhole1,
@ -176,7 +176,7 @@ export const paperlessBarrelCuff = part => {
return part return part
} }
export const paperlessFrenchCuff = part => { export const paperlessFrenchCuff = (part) => {
let { sa, macro, points } = part.shorthand() let { sa, macro, points } = part.shorthand()
macro('hd', { macro('hd', {
from: points.button4, from: points.button4,