fix(penelope): Support drafting for non-human measurements
Closes #1320
This commit is contained in:
parent
8885e7da47
commit
35e292daaf
5 changed files with 34 additions and 31 deletions
|
@ -37,6 +37,7 @@ export default {
|
|||
hide: [],
|
||||
parts: ['front', 'back', 'waistband'],
|
||||
options: {
|
||||
// FIXME: All of these constants mean this pattern won't scale properly :(
|
||||
dartMaximumDifference: 300,
|
||||
dartMinimumDifference: 180,
|
||||
dartMinimumWidth: 6,
|
||||
|
@ -50,21 +51,21 @@ export default {
|
|||
hipCurveDividerDown: 40,
|
||||
hipCurveDividerUp: 3,
|
||||
sideSeamShiftPercentage: 0.006,
|
||||
backVentWidth: 50,
|
||||
backVentWidth: 0.1,
|
||||
paperlessOffset: 15,
|
||||
waistBandOverlap: 25,
|
||||
lengthBonus: { pct: 0, min: -50, max: 50 },
|
||||
hemBonus: { pct: 0, min: -35, max: 0 },
|
||||
hem: { mm: 25, min: 0, max: 75 },
|
||||
hem: { pct: 2, min: 0, max: 5 },
|
||||
backVent: { bool: true },
|
||||
backVentLength: { pct: 40, min: 5, max: 70 },
|
||||
waistBand: { bool: true },
|
||||
waistBandWidth: { mm: 50, min: 10, max: 200 },
|
||||
waistBandWidth: { pct: 10, min: 5, max: 20 },
|
||||
zipperLocation: { dflt: 'backSeam', list: ['backSeam', 'sideSeam'] },
|
||||
nrOfDarts: { count: 2, min: 1, max: 2 },
|
||||
|
||||
seatEase: { mm: 5, min: 0, max: 15 },
|
||||
waistEase: { mm: 5, min: 0, max: 15 },
|
||||
seatEase: { pct: 1, min: 0, max: 5 },
|
||||
waistEase: { pct: 1, min: 0, max: 5 },
|
||||
backDartDepthFactor: { pct: 50, min: 35, max: 70 },
|
||||
frontDartDepthFactor: { pct: 45, min: 30, max: 65 },
|
||||
dartToSideSeamFactor: { pct: 50, min: 30, max: 70 },
|
||||
|
|
|
@ -26,10 +26,12 @@ export default function (part) {
|
|||
options.backVentLength * store.get('skirtLength')
|
||||
)
|
||||
|
||||
points.vLeg = points.lLeg.shift(180, options.backVentWidth)
|
||||
points.vHem = points.lHem.shift(180, options.backVentWidth)
|
||||
points.vLeg = points.rLeg.shiftFractionTowards(points.lLeg, 1 + options.backVentWidth)
|
||||
points.vHem = points.rHem.shiftFractionTowards(points.lHem, 1 + options.backVentWidth)
|
||||
points.vTop = points.vLeg.shift(90, backVentLength)
|
||||
points.lVent = points.vTop.shift(0, options.backVentWidth).shift(90, options.backVentWidth)
|
||||
points.lVent = points.vTop
|
||||
.shift(0, points.lLeg.dx(points.rLeg) * options.backVentWidth)
|
||||
.shift(90, points.lLeg.dx(points.rLeg) * options.backVentWidth)
|
||||
|
||||
paths.vent = new Path()
|
||||
.move(points.lVent)
|
||||
|
|
|
@ -3,14 +3,11 @@ import { BuildMainShape } from './shape'
|
|||
export default function (part) {
|
||||
let {
|
||||
options,
|
||||
/*measurements,*/
|
||||
/*Point,*/
|
||||
Path,
|
||||
points,
|
||||
paths,
|
||||
Snippet,
|
||||
snippets,
|
||||
/*store,*/
|
||||
complete,
|
||||
sa,
|
||||
paperless,
|
||||
|
|
|
@ -1,22 +1,23 @@
|
|||
import { addDartToCurve, dartCalc } from './utils'
|
||||
|
||||
function BuildMainShape(part, frontPart) {
|
||||
let { sa, options, measurements, Point, Path, points, paths, store, paperless, macro } =
|
||||
const { sa, options, measurements, Point, Path, points, paths, store, paperless, macro } =
|
||||
part.shorthand()
|
||||
|
||||
let skirtLength = measurements.waistToKnee * (1 + options.lengthBonus) // + options.hem;
|
||||
|
||||
store.set('skirtLength', skirtLength)
|
||||
|
||||
let waistEase = options.waistEase
|
||||
let seatEase = options.seatEase
|
||||
store.set('waistEase', measurements.waist * options.waistEase)
|
||||
store.set('seatEase', measurements.seat * options.seatEase)
|
||||
// [joost] I don't like how hem is handled here rather than as hem allowance
|
||||
store.set('hem', measurements.waistToKnee * options.hem)
|
||||
|
||||
let dartDepthFactor = frontPart ? options.frontDartDepthFactor : options.backDartDepthFactor
|
||||
|
||||
let waist = measurements.waist
|
||||
let seat = measurements.seat > waist ? measurements.seat : waist
|
||||
|
||||
dartCalc(store, options, seat, seatEase, waist, waistEase)
|
||||
dartCalc(store, options, seat, store.get('seatEase'), waist, store.get('waistEase'))
|
||||
|
||||
let nrOfDarts = store.get('nrOfDarts')
|
||||
let dartSize = store.get('frontDartSize')
|
||||
|
@ -33,8 +34,8 @@ function BuildMainShape(part, frontPart) {
|
|||
|
||||
let sideSeamShift = (frontPart ? -1 : 1) * options.sideSeamShiftPercentage * seat
|
||||
|
||||
seat += seatEase
|
||||
waist += waistEase
|
||||
seat += store.get('seatEase')
|
||||
waist += store.get('waistEase')
|
||||
|
||||
let sideSeam = seat / 4 + sideSeamShift
|
||||
|
||||
|
@ -70,14 +71,14 @@ function BuildMainShape(part, frontPart) {
|
|||
|
||||
do {
|
||||
if (wdelta < -1) {
|
||||
waistFactor *= 0.9995
|
||||
waistFactor *= 0.99
|
||||
} else if (wdelta > 1) {
|
||||
waistFactor *= 1.01
|
||||
waistFactor *= 1.02
|
||||
}
|
||||
if (sdelta < -1) {
|
||||
sideFactor *= 0.995
|
||||
sideFactor *= 0.98
|
||||
} else if (sdelta > 1) {
|
||||
sideFactor *= 1.01
|
||||
sideFactor *= 1.03
|
||||
}
|
||||
points.rWaistTemp1 = points.lWaist.shift(0, (waist / 4) * waistFactor)
|
||||
points.rWaistTemp2 = points.rWaistTemp1.shift(0, dartSize * nrOfDarts)
|
||||
|
@ -145,6 +146,7 @@ function BuildMainShape(part, frontPart) {
|
|||
sideSeamLength = sideSeamPath.length()
|
||||
sdelta = store.get('sideSeamLength') - sideSeamLength
|
||||
}
|
||||
|
||||
} while ((Math.abs(wdelta) > 1 || Math.abs(sdelta) > 1) && iteration++ < 100)
|
||||
|
||||
paths.waist1 = waistCurve.translate(0, 10).attr('class', 'lining dashed')
|
||||
|
@ -167,10 +169,10 @@ function BuildMainShape(part, frontPart) {
|
|||
.attr('class', 'fabric stroke-sm')
|
||||
.setRender(false)
|
||||
|
||||
if (options.hem > 0) {
|
||||
if (store.get('hem') > 0) {
|
||||
// Create the inverse of the curve from the leg to the waist
|
||||
// Then split it at the hem level
|
||||
points.lHem = points.lLeg.shift(270, options.hem)
|
||||
points.lHem = points.lLeg.shift(270, store.get('hem'))
|
||||
let rInverseSeat = points.rSeat.shift(270, (points.rLeg.y - points.rSeat.y) * 2)
|
||||
let rInverseSeatCP = rInverseSeat.shift(90, points.rSeatCPdown.y - points.rSeat.y)
|
||||
let rInversePath = new Path().move(rInverseSeat).curve(rInverseSeatCP, points.rLeg, points.rLeg)
|
||||
|
@ -215,7 +217,7 @@ function BuildMainShape(part, frontPart) {
|
|||
to: points.lLeg,
|
||||
x: points.lLeg.x + options.paperlessOffset + sa,
|
||||
})
|
||||
if (options.hem > 0) {
|
||||
if (store.get('hem') > 0) {
|
||||
macro('vd', {
|
||||
from: points.lLeg,
|
||||
to: points.lHem,
|
||||
|
|
|
@ -12,6 +12,7 @@ export default function (part) {
|
|||
sa,
|
||||
paperless,
|
||||
macro,
|
||||
store
|
||||
} = part.shorthand()
|
||||
|
||||
if (!options.waistBand) {
|
||||
|
@ -19,17 +20,17 @@ export default function (part) {
|
|||
return part
|
||||
}
|
||||
|
||||
let waistEase = options.waistEase
|
||||
let waist = measurements.waist
|
||||
waist += waistEase
|
||||
waist += measurements.waist * options.waistEase
|
||||
store.set('waistBandWidth', options.waistBandWidth * measurements.waistToKnee)
|
||||
|
||||
points.TL = new Point(0, 0)
|
||||
points.BL = new Point(0, waist / 2 + options.waistBandOverlap)
|
||||
points.TR = new Point(options.waistBandWidth, 0)
|
||||
points.BR = new Point(options.waistBandWidth, waist / 2 + options.waistBandOverlap)
|
||||
points.TR = new Point(store.get('waistBandWidth'), 0)
|
||||
points.BR = new Point(store.get('waistBandWidth'), waist / 2 + options.waistBandOverlap)
|
||||
|
||||
points.titleAnchor = new Point(options.waistBandWidth / 2, waist / 6)
|
||||
points.logoAnchor = new Point(options.waistBandWidth / 2, waist / 3)
|
||||
points.titleAnchor = new Point(store.get('waistBandWidth') / 2, waist / 6)
|
||||
points.logoAnchor = new Point(store.get('waistBandWidth') / 2, waist / 3)
|
||||
|
||||
paths.outline = new Path()
|
||||
.move(points.TL)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue