fix(charlie): Curved waistband title rotation as other parts
This commit is contained in:
parent
cd4709ee3b
commit
60cd1e294e
1 changed files with 279 additions and 267 deletions
|
@ -18,37 +18,44 @@ export default (part) => {
|
||||||
} = part.shorthand()
|
} = part.shorthand()
|
||||||
|
|
||||||
if (options.waistbandCurve == 0) {
|
if (options.waistbandCurve == 0) {
|
||||||
return part;
|
return part
|
||||||
}
|
}
|
||||||
|
|
||||||
const fullWaist = 2 * (store.get('waistbandBack') + store.get('waistbandFront'));
|
const fullWaist = 2 * (store.get('waistbandBack') + store.get('waistbandFront'))
|
||||||
const sideSeamFraction = 0.5 * store.get('waistbandFront') / (store.get('waistbandBack') + store.get('waistbandFront'))
|
const sideSeamFraction =
|
||||||
const radius = fullWaist / (2 * Math.PI * options.waistbandCurve);
|
(0.5 * store.get('waistbandFront')) / (store.get('waistbandBack') + store.get('waistbandFront'))
|
||||||
const angle = 360 * options.waistbandCurve;
|
const radius = fullWaist / (2 * Math.PI * options.waistbandCurve)
|
||||||
|
const angle = 360 * options.waistbandCurve
|
||||||
|
|
||||||
points.center = new Point(0, 0);
|
points.center = new Point(0, 0)
|
||||||
|
|
||||||
points.cfLeftBottom = points.center.shift(0, radius);
|
points.cfLeftBottom = points.center.shift(0, radius)
|
||||||
points.cbBottom = points.cfLeftBottom.rotate(0.5 * angle, points.center);
|
points.cbBottom = points.cfLeftBottom.rotate(0.5 * angle, points.center)
|
||||||
points.cfRightBottom = points.cfLeftBottom.rotate(angle, points.center);
|
points.cfRightBottom = points.cfLeftBottom.rotate(angle, points.center)
|
||||||
|
|
||||||
points.cfLeftTop = points.cfLeftBottom.shiftTowards(points.center, options.waistbandWidth);
|
points.cfLeftTop = points.cfLeftBottom.shiftTowards(points.center, options.waistbandWidth)
|
||||||
points.cbTop = points.cfLeftTop.rotate(0.5 * angle, points.center);
|
points.cbTop = points.cfLeftTop.rotate(0.5 * angle, points.center)
|
||||||
points.cfRightTop = points.cfRightBottom.shiftTowards(points.center, options.waistbandWidth);
|
points.cfRightTop = points.cfRightBottom.shiftTowards(points.center, options.waistbandWidth)
|
||||||
|
|
||||||
// Calculate control points for circle arc
|
// Calculate control points for circle arc
|
||||||
// https://math.stackexchange.com/questions/873224/calculate-control-points-of-cubic-bezier-curve-approximating-a-part-of-a-circle
|
// https://math.stackexchange.com/questions/873224/calculate-control-points-of-cubic-bezier-curve-approximating-a-part-of-a-circle
|
||||||
const a = (4 / 3) * Math.tan(2 * Math.PI * options.waistbandCurve / 4);
|
const a = (4 / 3) * Math.tan((2 * Math.PI * options.waistbandCurve) / 4)
|
||||||
|
|
||||||
points.cfLeftBottomCp = points.cfLeftBottom.shift(90, a * radius);
|
points.cfLeftBottomCp = points.cfLeftBottom.shift(90, a * radius)
|
||||||
points.cfRightBottomCp = points.cfRightBottom.shift(angle - 90, a * radius);
|
points.cfRightBottomCp = points.cfRightBottom.shift(angle - 90, a * radius)
|
||||||
|
|
||||||
points.cfLeftTopCp = points.cfLeftTop.shift(90, a * (radius - options.waistbandWidth))
|
points.cfLeftTopCp = points.cfLeftTop.shift(90, a * (radius - options.waistbandWidth))
|
||||||
points.cfRightTopCp = points.cfRightTop.shift(angle - 90, a * (radius - options.waistbandWidth))
|
points.cfRightTopCp = points.cfRightTop.shift(angle - 90, a * (radius - options.waistbandWidth))
|
||||||
|
|
||||||
// Add fly underlap
|
// Add fly underlap
|
||||||
points.edgeRightTop = points.cfRightTop.shiftTowards(points.cfRightTopCp, - store.get('waistbandFly'))
|
points.edgeRightTop = points.cfRightTop.shiftTowards(
|
||||||
points.edgeRightBottom = points.cfRightBottom.shiftTowards(points.cfRightBottomCp, - store.get('waistbandFly'))
|
points.cfRightTopCp,
|
||||||
|
-store.get('waistbandFly')
|
||||||
|
)
|
||||||
|
points.edgeRightBottom = points.cfRightBottom.shiftTowards(
|
||||||
|
points.cfRightBottomCp,
|
||||||
|
-store.get('waistbandFly')
|
||||||
|
)
|
||||||
|
|
||||||
paths.waistbandTop = new Path()
|
paths.waistbandTop = new Path()
|
||||||
.move(points.cfRightTop)
|
.move(points.cfRightTop)
|
||||||
|
@ -59,12 +66,11 @@ export default (part) => {
|
||||||
.move(points.cfRightBottom)
|
.move(points.cfRightBottom)
|
||||||
.curve(points.cfRightBottomCp, points.cfLeftBottomCp, points.cfLeftBottom)
|
.curve(points.cfRightBottomCp, points.cfLeftBottomCp, points.cfLeftBottom)
|
||||||
|
|
||||||
points.ssRightBottom = paths.waistbandBottom.shiftFractionAlong(sideSeamFraction);
|
points.ssRightBottom = paths.waistbandBottom.shiftFractionAlong(sideSeamFraction)
|
||||||
points.ssLeftBottom = paths.waistbandBottom.shiftFractionAlong(1 - sideSeamFraction);
|
points.ssLeftBottom = paths.waistbandBottom.shiftFractionAlong(1 - sideSeamFraction)
|
||||||
|
|
||||||
points.ssRightTop = paths.waistbandTop.shiftFractionAlong(sideSeamFraction);
|
|
||||||
points.ssLeftTop = paths.waistbandTop.shiftFractionAlong(1 - sideSeamFraction);
|
|
||||||
|
|
||||||
|
points.ssRightTop = paths.waistbandTop.shiftFractionAlong(sideSeamFraction)
|
||||||
|
points.ssLeftTop = paths.waistbandTop.shiftFractionAlong(1 - sideSeamFraction)
|
||||||
|
|
||||||
paths.saBase = new Path()
|
paths.saBase = new Path()
|
||||||
.move(points.cfLeftBottom)
|
.move(points.cfLeftBottom)
|
||||||
|
@ -79,20 +85,27 @@ export default (part) => {
|
||||||
paths.seam = paths.saBase.clone().attr('class', 'fabric').setRender(true)
|
paths.seam = paths.saBase.clone().attr('class', 'fabric').setRender(true)
|
||||||
|
|
||||||
if (complete) {
|
if (complete) {
|
||||||
raise.info(
|
raise.info(`Top of waistband: ${units(paths.waistbandTop.length())}`)
|
||||||
`Top of waistband: ${units(paths.waistbandTop.length())}`
|
|
||||||
)
|
|
||||||
macro('sprinkle', {
|
macro('sprinkle', {
|
||||||
snippet: 'notch',
|
snippet: 'notch',
|
||||||
on: ['cfRightBottom', 'cfRightTop', 'cbBottom', 'cbTop', 'ssLeftBottom', 'ssRightBottom', 'ssLeftTop', 'ssRightTop']
|
on: [
|
||||||
|
'cfRightBottom',
|
||||||
|
'cfRightTop',
|
||||||
|
'cbBottom',
|
||||||
|
'cbTop',
|
||||||
|
'ssLeftBottom',
|
||||||
|
'ssRightBottom',
|
||||||
|
'ssLeftTop',
|
||||||
|
'ssRightTop'
|
||||||
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
points.titleAnchor = points.cfLeftBottom.shiftFractionTowards(points.ssLeftTop, 0.4)
|
points.titleAnchor = points.cfLeftTop.shiftFractionTowards(points.ssLeftBottom, 0.5)
|
||||||
macro('title', {
|
macro('title', {
|
||||||
at: points.titleAnchor,
|
at: points.titleAnchor,
|
||||||
nr: 11,
|
nr: 11,
|
||||||
title: 'waistband',
|
title: 'waistband',
|
||||||
rotation: -90
|
rotation: 90
|
||||||
})
|
})
|
||||||
|
|
||||||
macro('grainline', {
|
macro('grainline', {
|
||||||
|
@ -122,16 +135,16 @@ export default (part) => {
|
||||||
let buttonScale = options.waistbandWidth / 14
|
let buttonScale = options.waistbandWidth / 14
|
||||||
points.button = points.edgeRightBottom.shiftFractionTowards(points.cfRightTop, 0.6)
|
points.button = points.edgeRightBottom.shiftFractionTowards(points.cfRightTop, 0.6)
|
||||||
snippets.button = new Snippet('button', points.button).attr('data-scale', buttonScale)
|
snippets.button = new Snippet('button', points.button).attr('data-scale', buttonScale)
|
||||||
points.buttonhole = new Point(points.cfLeftTop.x + 0.4 * options.waistbandWidth, points.cfLeftTop.y - store.get('waistbandFly') * 0.4)
|
points.buttonhole = new Point(
|
||||||
|
points.cfLeftTop.x + 0.4 * options.waistbandWidth,
|
||||||
|
points.cfLeftTop.y - store.get('waistbandFly') * 0.4
|
||||||
|
)
|
||||||
snippets.buttonhole = new Snippet('buttonhole-start', points.buttonhole).attr(
|
snippets.buttonhole = new Snippet('buttonhole-start', points.buttonhole).attr(
|
||||||
'data-scale',
|
'data-scale',
|
||||||
buttonScale
|
buttonScale
|
||||||
)
|
)
|
||||||
if (sa) {
|
if (sa) {
|
||||||
paths.sa = paths.saBase
|
paths.sa = paths.saBase.offset(sa).close().attr('class', 'fabric sa')
|
||||||
.offset(sa)
|
|
||||||
.close()
|
|
||||||
.attr('class', 'fabric sa')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (paperless) {
|
if (paperless) {
|
||||||
|
@ -263,7 +276,6 @@ export default (part) => {
|
||||||
to: points.cfLeftTop,
|
to: points.cfLeftTop,
|
||||||
x: points.ssLeftTop.x - sa - 15
|
x: points.ssLeftTop.x - sa - 15
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue