1
0
Fork 0
freesewing/designs/wahid/src/back.mjs

271 lines
6.9 KiB
JavaScript
Raw Normal View History

2022-09-03 15:41:48 +02:00
import { constructMainDart, shapeSideSeam, dartPath } from './shared.mjs'
import { back as brianBack } from '@freesewing/brian'
import { backInset, shoulderInset, neckInset, centerBackDart, backScyeDart } from './options.mjs'
import { hidePresets } from '@freesewing/core'
2019-02-17 20:42:05 +01:00
2022-09-11 08:14:04 -07:00
function wahidBack({
points,
Point,
paths,
Path,
measurements,
options,
macro,
2023-09-21 09:07:26 +02:00
store,
2022-09-11 08:14:04 -07:00
sa,
snippets,
part,
}) {
2019-02-17 20:42:05 +01:00
// Cleanup from Brian
2019-08-03 15:03:33 +02:00
for (let i of Object.keys(paths)) delete paths[i]
delete snippets.armholePitchNotch
2019-02-17 20:42:05 +01:00
// Back inset
2019-08-03 15:03:33 +02:00
let shoulderLen = points.shoulder.dist(points.neck)
let backInset = shoulderLen * options.backInset
points.armholePitch = points.armholePitch.shift(180, backInset)
points.armholePitchCp1 = points.armholePitchCp1.shift(180, backInset)
points.armholePitchCp2 = points.armholePitchCp2.shift(180, backInset)
points.armholeHollow = points.armholeHollow.shift(180, backInset / 2)
points.armholeHollowCp2 = points.armholeHollowCp2.shift(180, backInset / 2)
points.armholeHollowCp1 = points.armholeHollowCp1.shift(180, backInset / 2)
2019-02-17 20:42:05 +01:00
// Shoulder inset
2019-08-03 15:03:33 +02:00
points.shoulder = points.shoulder.shiftTowards(points.neck, shoulderLen * options.shoulderInset)
2019-02-17 20:42:05 +01:00
points.shoulderCp1 = points.shoulderCp1.shift(
points.shoulder.angle(points.neck),
shoulderLen * options.shoulderInset
2019-08-03 15:03:33 +02:00
)
2019-02-17 20:42:05 +01:00
// Neck inset
2019-08-03 15:03:33 +02:00
points.neck = points.neck.shiftTowards(points.shoulder, shoulderLen * options.neckInset)
points.neckCp2 = points.neck.shift(points.shoulder.angle(points.neck) + 90, shoulderLen * 0.1)
2019-02-17 20:42:05 +01:00
// Center back dart
points.cbNeck = new Path()
.move(points.cbNeck)
._curve(points.neckCp2, points.neck)
2019-08-03 15:03:33 +02:00
.shiftAlong(measurements.shoulderToShoulder * options.centerBackDart)
points.cbNeckCp2 = new Point(0, points.armholePitch.y)
2019-02-17 20:42:05 +01:00
// Construct main dart
2019-08-03 15:03:33 +02:00
constructMainDart(part)
2019-02-17 20:42:05 +01:00
// Add dart start and end point regardless of style or front or back
2019-08-03 15:03:33 +02:00
points.dartStart = points.dartHemLeft
points.dartEnd = points.dartHemRight
2019-02-17 20:42:05 +01:00
// Shape side seam
2019-08-03 15:03:33 +02:00
shapeSideSeam(part)
2019-02-17 20:42:05 +01:00
// Back scye dart
points._dartWidth = points.cbNeckCp2.shiftFractionTowards(
points.armholePitch.rotate(options.backScyeDart, points.cbNeckCp2),
1.2
2019-08-03 15:03:33 +02:00
)
release: v2.18.0 ## 2.18.0 (2021-09-09) ### core #### Fixed - Handle path.offset() of very short curves with control points on the start or end point Closes [#1257](https://github.com/freesewing/freesewing/issues/1257) ### holmes #### Fixed - The `brimWidth` option is not a percent option, allowing the pattern to scale properly ### huey #### Fixed - Replace cut-on-fold indicator on pocket with a regular grainline indicator Closes [#1265](https://github.com/freesewing/freesewing/issues/1265) ### i18n #### Added - Added translations for Yuri #### Fixed - Added optional chaining so missing options always lead to clear error message ### simon #### Fixed - Avoid paperless depending on a complete pattern ### theo #### Fixed - Avoid paperless depending on a complete pattern ### wahid #### Fixed - Close Seam Allowance path of front lining Closes [#1267](https://github.com/freesewing/freesewing/issues/1267) - Support a zero value for the `backScyeDart` option ### yuri - Handle path.offset() of very short curves with control points on the start or end point Closes [#1257](https://github.com/freesewing/freesewing/issues/1257) - The `brimWidth` option is not a percent option, allowing the pattern to scale properly - Replace cut-on-fold indicator on pocket with a regular grainline indicator Closes [#1265](https://github.com/freesewing/freesewing/issues/1265) - Added translations for Yuri - Added optional chaining so missing options always lead to clear error message - Avoid paperless depending on a complete pattern - Avoid paperless depending on a complete pattern - Close Seam Allowance path of front lining Closes [#1267](https://github.com/freesewing/freesewing/issues/1267) - Support a zero value for the `backScyeDart` option
2021-09-09 20:25:59 +02:00
points.armholePitchTop =
options.backScyeDart > 0
? new Path()
.move(points.armholePitch)
.curve(points.armholePitchCp2, points.shoulderCp1, points.shoulder)
.intersects(new Path().move(points.cbNeckCp2).line(points._dartWidth))
.pop()
: points.armholePitch.clone()
2019-02-17 20:42:05 +01:00
// Rotate back scye dart into center back
2019-08-03 15:03:33 +02:00
let toRotate = ['cbNeck', 'neckCp2', 'neck', 'shoulder', 'shoulderCp1']
2019-02-17 20:42:05 +01:00
for (let p of toRotate) {
2019-08-03 15:03:33 +02:00
points[p] = points[p].rotate(options.backScyeDart, points.cbNeckCp2)
2019-02-17 20:42:05 +01:00
}
// Seam line
2019-08-03 15:03:33 +02:00
delete paths.cutonfold
delete paths.saBase
delete paths.sa
2019-02-17 20:42:05 +01:00
paths.saBase = new Path()
.move(points.hem)
.line(points.hips)
.curve(points.hipsCp2, points.waistCp1, points.waist)
.curve_(points.waistCp2, points.armhole)
.curve(points.armholeCp2, points.armholeHollowCp1, points.armholeHollow)
.curve(points.armholeHollowCp2, points.armholePitchCp1, points.armholePitch)
.curve(points.armholePitchCp2, points.shoulderCp1, points.shoulder)
.line(points.neck)
.curve_(points.neckCp2, points.cbNeck)
._curve(points.cbNeckCp2, points.cbArmhole)
2019-08-03 15:03:33 +02:00
.line(points.cbHem)
paths.hemBase = new Path().move(points.cbHem).line(points.hem)
paths.dart = dartPath(part)
2019-02-17 20:42:05 +01:00
paths.seam = paths.saBase
.clone()
.line(points.dartHemLeft)
.join(paths.dart)
.line(points.hem)
2019-08-03 15:03:33 +02:00
.attr('class', 'fabric')
2023-09-21 09:07:26 +02:00
if (sa)
paths.sa = paths.saBase
.offset(sa)
.join(paths.hemBase.offset(sa))
.close()
.attr('class', 'fabric sa')
2022-09-18 17:01:19 +02:00
paths.saBase.hide()
paths.hemBase.hide()
paths.hemBase.hide()
paths.dart.hide()
2019-02-17 20:42:05 +01:00
2023-09-21 09:07:26 +02:00
/*
* Annotations
*/
// Cutlist
store.cutlist.setCut({ cut: 2, from: 'fabric' })
// Title
macro('title', {
at: points.title,
nr: 2,
align: 'center',
})
//Grainline
points.grainlineBottom = new Point(points.logo.x / 2, points.cbNeck.y)
points.grainlineTop = new Point(points.grainlineBottom.x, points.gridAnchor.y)
macro('grainline', {
from: points.grainlineTop,
to: points.grainlineBottom,
})
// Scalebox
macro('scalebox', { at: new Point(points.logo.x, points.cfNeck.y) })
// Dimensions
macro('ld', {
id: 'lShoulderSeam',
from: points.neck,
to: points.shoulder,
d: 15 + sa,
})
macro('hd', {
id: 'wCbDart',
from: points.cbArmhole,
to: points.cbNeck,
y: points.cbNeck.y - 15 - sa,
})
macro('hd', {
id: 'wCbToHps',
from: points.cbArmhole,
to: points.neck,
y: points.cbNeck.y - 30 - sa,
})
macro('hd', {
id: 'wCbToShoulder',
from: points.cbArmhole,
to: points.shoulder,
y: points.cbNeck.y - 45 - sa,
})
macro('hd', {
id: 'wCbToArmholePitch',
from: points.cbArmhole,
to: points.armholePitch,
y: points.armholePitch.y,
})
macro('hd', {
id: 'wCbToDartTip',
from: points.cbArmhole,
to: points.dartTop,
y: points.dartTop.y - 15,
})
macro('vd', {
id: 'hArmholeToArmholePitch',
from: points.armhole,
to: points.armholePitch,
x: points.armhole.x + 15 + sa,
})
macro('vd', {
id: 'hArmholeTpShoulder',
from: points.armhole,
to: points.shoulder,
x: points.armhole.x + 30 + sa,
})
macro('vd', {
id: 'hArmholeToHps',
from: points.armhole,
to: points.neck,
x: points.armhole.x + 45 + sa,
})
macro('vd', {
id: 'hHemToWaist',
from: points.hem,
to: points.waist,
x: points.armhole.x + 15 + sa,
})
macro('vd', {
id: 'hHemToArmhole',
from: points.hem,
to: points.armhole,
x: points.armhole.x + 30 + sa,
})
macro('hd', {
id: 'wDartSideAtHemToSide',
from: points.dartHemRight,
to: points.hem,
y: points.hem.y + 3 * sa + 15,
})
macro('hd', {
id: 'wDartSideAtHemToCb',
from: points.cbHem,
to: points.dartHemLeft,
y: points.hem.y + 3 * sa + 15,
})
macro('hd', {
id: 'wAtHem',
from: points.cbHem,
to: points.hem,
y: points.hem.y + 3 * sa + 30,
})
macro('ld', {
id: 'lDartAtWaist',
from: points.dartWaistLeft,
to: points.dartWaistRight,
})
macro('ld', {
id: 'wDartAtHip',
from: points.dartHipLeft,
to: points.dartHipRight,
})
macro('vd', {
id: 'hHemToArmhole',
from: points.cbHem,
to: points.cbArmhole,
x: points.cbHem.x - 15 - sa,
})
macro('vd', {
id: 'hHemToCbNeck',
from: points.cbHem,
to: points.cbNeck,
x: points.cbHem.x - 30 - sa,
})
macro('vd', {
id: 'hFull',
from: points.cbHem,
to: points.neck,
x: points.cbHem.x - 45 - sa,
})
2019-02-17 20:42:05 +01:00
2019-08-03 15:03:33 +02:00
return part
}
2022-09-03 15:41:48 +02:00
export const back = {
name: 'wahid.back',
from: brianBack,
hide: hidePresets.HIDE_TREE,
2022-09-03 15:41:48 +02:00
measurements: ['hips', 'waist'],
options: {
backInset,
shoulderInset,
neckInset,
centerBackDart,
backScyeDart,
},
draft: wahidBack,
}