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

69 lines
2.8 KiB
JavaScript
Raw Normal View History

export const constructMainDart = (part) => {
2023-09-21 09:07:26 +02:00
const { measurements, options, points, Point, store } = part.shorthand()
2019-02-17 17:21:39 +01:00
2023-09-21 09:07:26 +02:00
const reduce = {}
const chest = measurements.chest * (1 + options.chestEase)
const waist = measurements.waist * (1 + options.waistEase)
const hips = measurements.hips * (1 + options.hipsEase)
2019-02-17 17:21:39 +01:00
2019-08-03 15:03:33 +02:00
reduce.waist = chest - waist
reduce.hips = chest - hips
if (reduce.hips < 0) reduce.hips = 0
if (reduce.waist < 0) reduce.waist = 0
2019-02-17 17:21:39 +01:00
2019-08-03 15:03:33 +02:00
let wr12 = reduce.waist / 12
let hr12 = reduce.hips / 12
store.set('wr12', wr12)
store.set('hr12', hr12)
2019-02-17 17:21:39 +01:00
2019-08-03 15:03:33 +02:00
points.dartWaistCenter = new Point(points.armhole.x / 2, points.waist.y)
points.dartWaistRight = points.dartWaistCenter.shift(0, wr12)
points.dartWaistLeft = points.dartWaistCenter.shift(180, wr12)
points.dartTop = points.dartWaistCenter.shift(90, points.neck.dy(points.waist) * 0.35)
2019-02-17 17:21:39 +01:00
points.dartWaistRightCpTop = points.dartWaistRight.shift(
90,
2019-02-17 20:42:05 +01:00
points.dartTop.dy(points.waist) * 0.35
2019-08-03 15:03:33 +02:00
)
points.dartWaistLeftCpTop = points.dartWaistLeft.shift(90, points.dartTop.dy(points.waist) * 0.35)
points.dartHipCenter = new Point(points.dartWaistCenter.x, points.hips.y)
points.dartHipRight = points.dartHipCenter.shift(0, hr12)
points.dartHipLeft = points.dartHipCenter.shift(180, hr12)
points.dartHemRight = new Point(points.dartHipRight.x, points.hem.y)
points.dartHemLeft = new Point(points.dartHipLeft.x, points.hem.y)
points.dartHipRightCpTop = points.dartHipRight.shift(90, points.waist.dy(points.hips) * 0.25)
points.dartHipLeftCpTop = points.dartHipLeft.shift(90, points.waist.dy(points.hips) * 0.25)
2019-02-17 17:21:39 +01:00
points.dartWaistRightCpBottom = points.dartWaistRight.shift(
-90,
points.waist.dy(points.hips) * 0.25
2019-08-03 15:03:33 +02:00
)
2019-02-17 17:21:39 +01:00
points.dartWaistLeftCpBottom = points.dartWaistLeft.shift(
-90,
points.waist.dy(points.hips) * 0.25
2019-08-03 15:03:33 +02:00
)
}
2019-02-17 17:21:39 +01:00
export const shapeSideSeam = (part) => {
2023-09-21 09:07:26 +02:00
const { points, Point, store } = part.shorthand()
const wr12 = store.get('wr12')
const hr12 = store.get('hr12')
2019-02-17 17:21:39 +01:00
2019-08-03 15:03:33 +02:00
points.waist = points.waist.shift(180, wr12)
points.waistCp2 = new Point(points.waist.x, points.dartWaistRightCpTop.y)
points.waistCp1 = new Point(points.waist.x, points.dartWaistRightCpBottom.y)
points.hips = points.hips.shift(180, hr12)
points.hipsCp2 = new Point(points.hips.x, points.dartHipRightCpTop.y)
points.hem = points.hem.shift(180, hr12)
}
2019-02-17 20:42:05 +01:00
export const dartPath = (part) => {
2023-09-21 09:07:26 +02:00
const { Path, points } = part.shorthand()
2019-02-17 20:42:05 +01:00
return new Path()
.move(points.dartStart)
.line(points.dartHipLeft)
2019-08-03 15:03:33 +02:00
.curve(points.dartHipLeftCpTop, points.dartWaistLeftCpBottom, points.dartWaistLeft)
2019-02-17 20:42:05 +01:00
.curve_(points.dartWaistLeftCpTop, points.dartTop)
._curve(points.dartWaistRightCpTop, points.dartWaistRight)
2019-08-03 15:03:33 +02:00
.curve(points.dartWaistRightCpBottom, points.dartHipRightCpTop, points.dartHipRight)
.line(points.dartEnd)
}