2023-11-20 05:46:10 +00:00
|
|
|
import { pctBasedOn } from '@freesewing/core'
|
|
|
|
|
2023-12-16 17:57:37 +00:00
|
|
|
export const extendPath = (Path, pathToExtend, startLength = 100, endLength = 100) => {
|
|
|
|
return new Path()
|
|
|
|
.move(pathToExtend.shiftAlong(1).shiftOutwards(pathToExtend.start(), startLength))
|
|
|
|
.line(pathToExtend.start())
|
|
|
|
.join(pathToExtend)
|
|
|
|
.line(
|
|
|
|
pathToExtend
|
|
|
|
.shiftAlong(pathToExtend.length() - 1)
|
|
|
|
.shiftOutwards(pathToExtend.end(), endLength)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
export const controlPoints = (p1, p2, p3, cpDistanceDivider) => {
|
|
|
|
let angle
|
|
|
|
if (p1 === undefined) {
|
|
|
|
angle = p2.angle(p3) + 180
|
|
|
|
} else if (p3 === undefined) {
|
|
|
|
angle = p2.angle(p1)
|
|
|
|
} else {
|
|
|
|
angle = Math.abs(p2.angle(p1) - p2.angle(p3)) / 2
|
|
|
|
}
|
2023-12-24 23:36:17 +00:00
|
|
|
let cp1 =
|
|
|
|
p3 !== undefined ? p2.shift(p2.angle(p3) - angle + 90, p2.dist(p3) / cpDistanceDivider) : null
|
|
|
|
let cp2 =
|
|
|
|
p1 !== undefined ? p2.shift(p2.angle(p1) + angle - 90, p2.dist(p1) / cpDistanceDivider) : null
|
|
|
|
if (p1 !== undefined && p2.sitsRoughlyOn(p1)) {
|
|
|
|
return { cp1: p1.clone(), cp2: cp2 }
|
2023-12-16 17:57:37 +00:00
|
|
|
}
|
2023-12-24 23:36:17 +00:00
|
|
|
if (p3 !== undefined && p2.sitsRoughlyOn(p3)) {
|
2024-01-23 06:06:23 +00:00
|
|
|
return { cp1: cp1, cp2: p3.clone() }
|
2023-12-24 23:36:17 +00:00
|
|
|
}
|
|
|
|
return { cp1: cp1, cp2: cp2 }
|
2023-12-16 17:57:37 +00:00
|
|
|
}
|
|
|
|
export const createControlPoints = (points, cpDistanceDivider, names) => {
|
|
|
|
for (let i = 0; i < names.length; i++) {
|
|
|
|
let cp = controlPoints(
|
|
|
|
points[names[i - 1]],
|
|
|
|
points[names[i]],
|
|
|
|
points[names[i + 1]],
|
|
|
|
cpDistanceDivider
|
|
|
|
)
|
|
|
|
if (cp.cp1) points[names[i] + 'Cp1'] = cp.cp1
|
|
|
|
if (cp.cp2) points[names[i] + 'Cp2'] = cp.cp2
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const reduceWaist = (paths, Path, points, log, pathName, pointName, distance) => {
|
|
|
|
const path = extendPath(Path, paths[pathName], 100, 0)
|
|
|
|
const newPoint = path.shiftAlong(distance + 100)
|
|
|
|
if (newPoint.sitsRoughlyOn(points[pathName + 'Waist'])) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
points[pathName + pointName] = newPoint
|
|
|
|
const pTemp = path.split(points[pathName + pointName])
|
|
|
|
if (pTemp.length != 2) {
|
|
|
|
log.info('lumira:couldNotreduceWaist')
|
|
|
|
return
|
|
|
|
}
|
|
|
|
paths[pathName] = pTemp[1].hide()
|
|
|
|
}
|
|
|
|
|
|
|
|
const createGusset = (points, paths, Path, store, side, gussetWidth, gussetLength) => {
|
|
|
|
points[side + 'GussetCp'] = points[side + 'Gusset'].shiftFractionTowards(
|
|
|
|
points.centerUpperLeg,
|
|
|
|
0.1
|
|
|
|
)
|
|
|
|
const x1 = side == 'front' ? points[side + 'GussetJoin'].x : points[side + 'Gusset'].x
|
|
|
|
const x2 = side == 'front' ? points[side + 'Gusset'].x : points[side + 'GussetJoin'].x
|
|
|
|
if (points[side + 'GussetCp'].x < x1) {
|
|
|
|
points[side + 'GussetCp'].x = points[side + 'GussetJoin'].x
|
|
|
|
}
|
|
|
|
if (points[side + 'GussetCp'].x > x2) {
|
|
|
|
points[side + 'GussetCp'].x = points[side + 'Gusset'].x
|
|
|
|
}
|
|
|
|
|
|
|
|
const pGusset = new Path()
|
|
|
|
.move(points[side + 'GussetJoin'])
|
|
|
|
._curve(points[side + 'GussetCp'], points[side + 'Gusset'])
|
|
|
|
.hide()
|
|
|
|
const pGussetPoint = pGusset.shiftAlong(1)
|
|
|
|
const path = new Path()
|
|
|
|
.move(points[side + 'Waist'])
|
|
|
|
._curve(points[side + 'UpperLegCp2'], points[side + 'UpperLeg'])
|
|
|
|
.hide()
|
|
|
|
const pPoint = path.shiftAlong(1)
|
|
|
|
|
|
|
|
const angle1 =
|
|
|
|
side == 'front'
|
|
|
|
? points[side + 'GussetJoin'].angle(pGussetPoint)
|
|
|
|
: pPoint.angle(points[side + 'GussetJoin'])
|
|
|
|
const angle2 =
|
|
|
|
side == 'front'
|
|
|
|
? pPoint.angle(points[side + 'GussetJoin'])
|
|
|
|
: points[side + 'GussetJoin'].angle(pGussetPoint)
|
|
|
|
if (angle1 > angle2) {
|
|
|
|
points[side + 'GussetJoinCp'] = points[side + 'GussetJoin'].shift(
|
|
|
|
pPoint.angle(points[side + 'GussetJoin']),
|
|
|
|
gussetLength - gussetWidth
|
|
|
|
)
|
|
|
|
} else {
|
|
|
|
points[side + 'GussetJoinCp'] = points[side + 'GussetJoin'].clone()
|
|
|
|
}
|
|
|
|
|
|
|
|
paths[side + 'Gusset'] = new Path()
|
|
|
|
.move(points[side + 'GussetJoin'])
|
|
|
|
.curve(points[side + 'GussetJoinCp'], points[side + 'GussetCp'], points[side + 'Gusset'])
|
|
|
|
.hide()
|
2023-12-20 05:32:13 +00:00
|
|
|
const frontTemp = paths[side]
|
|
|
|
.reverse()
|
|
|
|
.shiftAlong(Math.min(gussetLength, paths[side].length()) - 1)
|
2023-12-16 17:57:37 +00:00
|
|
|
const gussetTemp = paths[side].shiftAlong(1)
|
|
|
|
const gussetAngle = Math.abs(
|
|
|
|
points[side + 'GussetJoin'].angle(gussetTemp) - frontTemp.angle(points[side + 'GussetJoin'])
|
|
|
|
)
|
|
|
|
store.set(side + 'GussetAngle', gussetAngle * 2)
|
|
|
|
|
2023-12-20 05:32:13 +00:00
|
|
|
const sideTop = paths[side].split(points[side + 'GussetJoin'])
|
|
|
|
if (sideTop[0].ops !== undefined) {
|
|
|
|
paths[side + 'Top'] = sideTop[0].hide()
|
|
|
|
} else {
|
|
|
|
paths[side + 'Top'] = paths[side].clone()
|
|
|
|
}
|
2023-12-16 17:57:37 +00:00
|
|
|
paths[side] = paths[side + 'Top']
|
|
|
|
.clone()
|
|
|
|
.join(paths[side + 'Gusset'])
|
|
|
|
.hide()
|
|
|
|
}
|
|
|
|
|
2023-11-20 05:46:10 +00:00
|
|
|
export const shape = {
|
|
|
|
name: 'lumira.shape',
|
|
|
|
measurements: [
|
|
|
|
'waist',
|
|
|
|
'waistBack',
|
|
|
|
'hips',
|
|
|
|
'seat',
|
|
|
|
'seatBack',
|
|
|
|
'upperLeg',
|
|
|
|
'knee',
|
|
|
|
'ankle',
|
|
|
|
'heel',
|
|
|
|
'inseam',
|
|
|
|
'crossSeam',
|
|
|
|
'crossSeamFront',
|
|
|
|
'waistToFloor',
|
|
|
|
'waistToKnee',
|
|
|
|
'waistToUpperLeg',
|
|
|
|
'waistToSeat',
|
|
|
|
'waistToHips',
|
|
|
|
],
|
|
|
|
options: {
|
|
|
|
// Constants
|
2023-11-29 07:05:56 +00:00
|
|
|
gussetcompensation: 1.03,
|
2023-11-28 06:31:40 +00:00
|
|
|
|
2023-11-20 05:46:10 +00:00
|
|
|
// Booleans
|
2023-11-30 04:32:20 +00:00
|
|
|
waistband: { bool: true, menu: 'style' },
|
2023-12-13 06:08:38 +00:00
|
|
|
backgusset: { bool: false, menu: 'style' },
|
2023-11-30 04:32:20 +00:00
|
|
|
cyclingchamois: { bool: false, menu: 'style' },
|
2023-11-29 07:05:56 +00:00
|
|
|
frontbulge: {
|
2023-11-25 20:05:30 +00:00
|
|
|
bool: false,
|
|
|
|
// eslint-disable-next-line no-unused-vars
|
2023-11-29 07:05:56 +00:00
|
|
|
menu: (settings, mergedOptions) => (mergedOptions?.cyclingchamois ? false : 'style'),
|
2023-11-25 20:05:30 +00:00
|
|
|
},
|
2023-11-20 05:46:10 +00:00
|
|
|
|
|
|
|
// Percentages
|
2023-12-20 04:56:47 +00:00
|
|
|
ease: { pct: -8, min: -30, max: 0, menu: 'fit' },
|
2023-12-01 06:43:29 +00:00
|
|
|
leglength: { pct: 100, min: 10, max: 100, ...pctBasedOn('inseam'), menu: 'style' },
|
2023-12-20 04:56:47 +00:00
|
|
|
waistlowering: { pct: 35, min: -10, max: 60, ...pctBasedOn('waistToHips'), menu: 'style' },
|
2023-11-29 07:05:56 +00:00
|
|
|
gussetwidth: {
|
2023-11-28 06:31:40 +00:00
|
|
|
pct: 16,
|
2023-11-29 07:05:56 +00:00
|
|
|
min: 5,
|
2023-11-25 20:05:30 +00:00
|
|
|
max: 30,
|
2023-11-22 05:04:10 +00:00
|
|
|
...pctBasedOn('crossSeamFront'),
|
|
|
|
// eslint-disable-next-line no-unused-vars
|
2023-11-29 07:05:56 +00:00
|
|
|
menu: (settings, mergedOptions) => (mergedOptions?.cyclingchamois ? false : 'style'),
|
2023-11-22 05:04:10 +00:00
|
|
|
},
|
2023-12-13 06:08:38 +00:00
|
|
|
backgussetwidth: {
|
|
|
|
pct: 50,
|
|
|
|
min: 20,
|
|
|
|
max: 75,
|
|
|
|
...pctBasedOn('hips'),
|
|
|
|
// eslint-disable-next-line no-unused-vars
|
|
|
|
menu: (settings, mergedOptions) => (mergedOptions?.backgusset ? 'fit' : false),
|
|
|
|
},
|
2023-11-29 07:05:56 +00:00
|
|
|
frontgussetlength: {
|
2023-11-25 20:05:30 +00:00
|
|
|
pct: 12.5,
|
2023-11-22 05:04:10 +00:00
|
|
|
min: 0,
|
2023-12-20 05:32:13 +00:00
|
|
|
max: 30,
|
2023-11-22 05:04:10 +00:00
|
|
|
...pctBasedOn('crossSeamFront'),
|
|
|
|
// eslint-disable-next-line no-unused-vars
|
2023-11-29 07:05:56 +00:00
|
|
|
menu: (settings, mergedOptions) => (mergedOptions?.frontbulge ? false : 'style'),
|
2023-11-22 05:04:10 +00:00
|
|
|
},
|
2023-11-29 07:05:56 +00:00
|
|
|
waistbandsize: {
|
2023-12-13 06:08:38 +00:00
|
|
|
pct: 90,
|
2023-11-24 18:57:55 +00:00
|
|
|
min: 0,
|
2023-12-13 06:08:38 +00:00
|
|
|
max: 150,
|
2023-11-24 18:57:55 +00:00
|
|
|
...pctBasedOn('waistToHips'),
|
|
|
|
// eslint-disable-next-line no-unused-vars
|
|
|
|
menu: (settings, mergedOptions) => (mergedOptions?.waistband ? 'style' : false),
|
|
|
|
},
|
2023-11-29 07:05:56 +00:00
|
|
|
waistreduction: {
|
2023-12-13 06:08:38 +00:00
|
|
|
pct: 4,
|
2023-11-24 18:57:55 +00:00
|
|
|
min: 0,
|
|
|
|
max: 10,
|
|
|
|
...pctBasedOn('waist'),
|
|
|
|
// eslint-disable-next-line no-unused-vars
|
|
|
|
menu: (settings, mergedOptions) => (mergedOptions?.waistband ? 'style' : false),
|
|
|
|
},
|
2023-11-20 05:46:10 +00:00
|
|
|
},
|
2023-11-30 07:03:09 +00:00
|
|
|
draft: ({ measurements, store, Point, points, Path, paths, options, utils, log, part }) => {
|
2023-12-16 17:57:37 +00:00
|
|
|
// draft: ({ store, Point, points, Path, paths, options, utils, log, part }) => {
|
2023-11-20 05:46:10 +00:00
|
|
|
const cpDistanceDivider = 3.5
|
2023-12-13 06:08:38 +00:00
|
|
|
const backGusset = options.cyclingchamois ? true : options.backgusset
|
2023-11-29 07:05:56 +00:00
|
|
|
const waistLowering = measurements.waistToHips * options.waistlowering
|
|
|
|
const waistReduction = options.waistband ? measurements.waist * options.waistreduction : 0
|
2023-11-24 18:57:55 +00:00
|
|
|
const waistbandSize = options.waistband
|
|
|
|
? measurements.waistToHips *
|
2023-12-13 06:08:38 +00:00
|
|
|
(options.waistlowering + options.waistbandsize > (backGusset ? 0.9 : 1.5)
|
|
|
|
? (backGusset ? 0.9 : 1.5) - options.waistlowering
|
2023-11-29 07:05:56 +00:00
|
|
|
: options.waistbandsize)
|
2023-11-24 18:57:55 +00:00
|
|
|
: 0
|
2023-11-25 20:05:30 +00:00
|
|
|
const gussetWidth =
|
2023-12-09 18:07:07 +00:00
|
|
|
measurements.crossSeamFront * (options.cyclingchamois ? 0.075 : options.gussetwidth * 0.5)
|
2023-11-29 07:05:56 +00:00
|
|
|
const backGussetWidth = options.backgussetwidth * 2.34
|
|
|
|
const frontGussetLength = measurements.crossSeamFront * options.frontgussetlength
|
|
|
|
const frontBulge = options.cyclingchamois ? true : options.frontbulge
|
2023-12-12 01:36:23 +00:00
|
|
|
const backGussetLength = measurements.crossSeamFront * options.frontgussetlength
|
2023-11-20 05:46:10 +00:00
|
|
|
|
2023-11-24 18:57:55 +00:00
|
|
|
store.set('waistLowering', waistLowering)
|
2023-11-20 05:46:10 +00:00
|
|
|
store.set('waistReduction', waistReduction)
|
2023-11-24 18:57:55 +00:00
|
|
|
store.set('waistbandSize', waistbandSize)
|
2023-11-20 05:46:10 +00:00
|
|
|
store.set('gussetWidth', gussetWidth)
|
|
|
|
store.set('frontGussetLength', frontGussetLength)
|
2023-12-12 01:36:23 +00:00
|
|
|
store.set('backGussetLength', backGussetLength)
|
2023-11-20 05:46:10 +00:00
|
|
|
|
|
|
|
const seatBackFrontRatio = measurements.seatBack / measurements.seatFront
|
|
|
|
const crossSeamBackFrontRatio = measurements.crossSeamBack / measurements.crossSeamFront
|
|
|
|
const waistToInseam = measurements.waistToFloor - measurements.inseam
|
|
|
|
const ease = 1 + options.ease
|
2023-12-01 06:43:29 +00:00
|
|
|
const legLength = measurements.inseam * options.leglength
|
2023-11-20 05:46:10 +00:00
|
|
|
|
|
|
|
points.centerWaist = new Point(0, 0)
|
|
|
|
points.centerFloor = new Point(0, measurements.waistToFloor)
|
|
|
|
points.centerAnkle = new Point(0, measurements.waistToFloor - measurements.heel / Math.PI)
|
|
|
|
points.centerKnee = new Point(0, measurements.waistToKnee)
|
|
|
|
points.centerUpperLeg = new Point(0, measurements.waistToUpperLeg)
|
|
|
|
points.centerInseam = new Point(0, waistToInseam)
|
|
|
|
points.centerHips = new Point(0, measurements.waistToHips)
|
|
|
|
points.centerSeat = new Point(0, measurements.waistToSeat)
|
|
|
|
|
|
|
|
points.frontAnkle = points.centerAnkle.shift(0, (measurements.ankle / 2) * ease)
|
|
|
|
points.backAnkle = points.centerAnkle.shift(180, (measurements.ankle / 2) * ease)
|
|
|
|
points.frontKnee = points.centerKnee.shift(0, (measurements.knee / 2) * ease)
|
|
|
|
points.backKnee = points.centerKnee.shift(180, (measurements.knee / 2) * ease)
|
|
|
|
points.frontUpperLeg = points.centerUpperLeg.shift(0, (measurements.upperLeg / 2) * ease)
|
|
|
|
points.backUpperLeg = points.centerUpperLeg.shift(180, (measurements.upperLeg / 2) * ease)
|
|
|
|
|
|
|
|
const backWaistAngle = utils.rad2deg(
|
|
|
|
Math.asin(
|
|
|
|
((measurements.waistToUpperLeg * seatBackFrontRatio * (crossSeamBackFrontRatio - 1)) /
|
|
|
|
measurements.waistBack) *
|
|
|
|
0.5 *
|
|
|
|
ease
|
|
|
|
)
|
|
|
|
)
|
|
|
|
const frontWaistAngle = utils.rad2deg(
|
|
|
|
Math.asin(
|
|
|
|
((measurements.waistToUpperLeg * seatBackFrontRatio * (crossSeamBackFrontRatio - 1)) /
|
|
|
|
measurements.waistFront) *
|
|
|
|
0.5 *
|
|
|
|
ease
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
points.backWaist = points.centerWaist.shift(
|
|
|
|
180 - backWaistAngle,
|
|
|
|
measurements.waistBack * 0.5 * ease
|
|
|
|
)
|
|
|
|
points.frontWaist = points.centerWaist.shift(
|
|
|
|
360 - frontWaistAngle,
|
|
|
|
measurements.waistFront * 0.5 * ease
|
|
|
|
)
|
|
|
|
points.backHips = points.centerHips.shift(180 - backWaistAngle, measurements.hips * 0.25 * ease)
|
|
|
|
|
|
|
|
points.frontHips = points.centerHips.shift(
|
|
|
|
360 - frontWaistAngle,
|
|
|
|
measurements.hips * 0.25 * ease
|
|
|
|
)
|
|
|
|
|
|
|
|
points.backSeat = points.centerSeat.shift(
|
|
|
|
180 - backWaistAngle,
|
|
|
|
measurements.seatBack * 0.5 * ease
|
|
|
|
)
|
|
|
|
|
|
|
|
points.frontSeat = points.centerSeat.shift(
|
|
|
|
360 - frontWaistAngle,
|
|
|
|
measurements.seatFront * 0.5 * ease
|
|
|
|
)
|
|
|
|
|
2023-12-16 17:57:37 +00:00
|
|
|
createControlPoints(points, cpDistanceDivider, ['frontWaist', 'frontSeat', 'frontUpperLeg'])
|
|
|
|
createControlPoints(points, cpDistanceDivider, ['backWaist', 'backSeat', 'backUpperLeg'])
|
2023-11-20 05:46:10 +00:00
|
|
|
|
2023-11-27 00:39:47 +00:00
|
|
|
points.frontUpperLegCp2 = points.frontUpperLeg.shiftFractionTowards(points.centerUpperLeg, 0.5)
|
|
|
|
points.frontUpperLegCp2Temp = points.frontUpperLeg.shiftFractionTowards(
|
|
|
|
points.centerUpperLeg,
|
|
|
|
0.5
|
|
|
|
)
|
2023-11-20 05:46:10 +00:00
|
|
|
points.backUpperLegCp2 = points.backUpperLeg.shiftFractionTowards(points.centerUpperLeg, 0.4)
|
|
|
|
|
|
|
|
paths.center = new Path().move(points.centerWaist).line(points.centerAnkle).hide()
|
|
|
|
|
|
|
|
paths.front = new Path()
|
|
|
|
.move(points.frontWaist)
|
2023-11-28 06:31:40 +00:00
|
|
|
._curve(points.frontUpperLegCp2, points.frontUpperLeg)
|
2023-11-20 05:46:10 +00:00
|
|
|
.hide()
|
|
|
|
paths.back = new Path()
|
|
|
|
.move(points.backWaist)
|
2023-11-28 06:31:40 +00:00
|
|
|
._curve(points.backUpperLegCp2, points.backUpperLeg)
|
2023-11-20 05:46:10 +00:00
|
|
|
.hide()
|
|
|
|
;['center', 'front', 'back'].forEach((prefix) => {
|
2023-12-16 17:57:37 +00:00
|
|
|
reduceWaist(paths, Path, points, log, prefix, 'Waist', waistLowering)
|
2023-11-20 05:46:10 +00:00
|
|
|
})
|
2023-11-28 06:31:40 +00:00
|
|
|
|
2023-11-24 18:57:55 +00:00
|
|
|
points.frontHips = paths.front.shiftAlong(measurements.waistToHips - waistLowering)
|
|
|
|
points.backHips = paths.back.shiftAlong(measurements.waistToHips - waistLowering)
|
2023-11-20 05:46:10 +00:00
|
|
|
|
|
|
|
paths.frontTop = paths.front.split(points.frontHips)[0].hide()
|
|
|
|
paths.backTop = paths.back.split(points.backHips)[0].hide()
|
2023-11-24 18:57:55 +00:00
|
|
|
;['center', 'front', 'back'].forEach((prefix) => {
|
|
|
|
points[prefix + 'Waistband'] = points[prefix + 'Waist'].clone()
|
2023-12-16 17:57:37 +00:00
|
|
|
reduceWaist(paths, Path, points, log, prefix, 'Waistband', waistbandSize)
|
2023-11-24 18:57:55 +00:00
|
|
|
})
|
2023-12-13 06:08:38 +00:00
|
|
|
points.backWaistbandTemp = points.backWaistband
|
|
|
|
|
|
|
|
if (!backGusset && options.waistband) {
|
2023-12-16 17:57:37 +00:00
|
|
|
reduceWaist(paths, Path, points, log, 'back', 'Waistband', measurements.crossSeamBack * 0.1)
|
2023-12-13 06:08:38 +00:00
|
|
|
}
|
|
|
|
points.backWaistband
|
|
|
|
points.centerWaistbandCp = points.frontWaistband.shiftFractionTowards(
|
|
|
|
points.centerWaistband,
|
|
|
|
1.2
|
|
|
|
)
|
|
|
|
points.backWaistbandCp2 = points.backWaistband.shiftFractionTowards(
|
|
|
|
points.centerWaistbandCp,
|
|
|
|
0.7
|
|
|
|
)
|
2023-11-24 18:57:55 +00:00
|
|
|
|
2023-12-13 06:08:38 +00:00
|
|
|
points.frontWaistbandCp = paths.frontTop.shiftAlong(
|
|
|
|
Math.min(waistbandSize / 2, paths.frontTop.length() * 0.95)
|
|
|
|
)
|
2023-11-24 18:57:55 +00:00
|
|
|
points.frontWaist = points.frontWaist.shiftTowards(points.centerWaist, waistReduction / 4)
|
|
|
|
paths.frontTop = new Path()
|
|
|
|
.move(points.frontWaist)
|
|
|
|
._curve(points.frontWaistbandCp, points.frontWaistband)
|
|
|
|
.hide()
|
|
|
|
|
2023-12-13 06:08:38 +00:00
|
|
|
points.backWaistbandCp1 = paths.backTop.shiftAlong(
|
|
|
|
Math.min(waistbandSize / 2, paths.backTop.length() * 0.95)
|
|
|
|
)
|
2023-11-24 18:57:55 +00:00
|
|
|
points.backWaist = points.backWaist.shiftTowards(points.centerWaist, waistReduction / 4)
|
|
|
|
paths.backTop = new Path()
|
|
|
|
.move(points.backWaist)
|
2023-12-13 06:08:38 +00:00
|
|
|
._curve(points.backWaistbandCp1, points.backWaistband)
|
2023-11-24 18:57:55 +00:00
|
|
|
.hide()
|
|
|
|
|
2023-12-13 06:08:38 +00:00
|
|
|
points.frontGusset = paths.front
|
|
|
|
.offset(gussetWidth)
|
2023-12-16 17:57:37 +00:00
|
|
|
.intersects(extendPath(Path, new Path().move(points.frontUpperLeg).line(points.frontKnee)))[0]
|
2023-12-13 06:08:38 +00:00
|
|
|
points.backGusset = paths.back
|
|
|
|
.offset(gussetWidth * -1)
|
2023-12-16 17:57:37 +00:00
|
|
|
.intersects(extendPath(Path, new Path().move(points.backUpperLeg).line(points.backKnee)))[0]
|
2023-11-20 05:46:10 +00:00
|
|
|
|
2023-12-20 05:32:13 +00:00
|
|
|
points.frontGussetJoin = paths.front
|
|
|
|
.reverse()
|
|
|
|
.shiftAlong(Math.min(frontGussetLength, paths.front.length()))
|
|
|
|
points.backGussetJoin = paths.back
|
|
|
|
.reverse()
|
|
|
|
.shiftAlong(Math.min(backGussetLength, paths.back.length()))
|
2023-11-20 05:46:10 +00:00
|
|
|
|
2023-11-25 20:05:30 +00:00
|
|
|
if (frontBulge) {
|
2023-12-16 17:57:37 +00:00
|
|
|
paths.front = extendPath(Path, paths.front.offset(gussetWidth)).hide()
|
|
|
|
const tempWaistline = new Path().move(points.frontWaistband).line(points.centerWaistband)
|
|
|
|
points.frontWaistband = paths.front.intersects(tempWaistline)[0]
|
|
|
|
|
|
|
|
if (false === points.frontWaistband.sitsRoughlyOn(paths.front.start())) {
|
|
|
|
paths.frontTemp = extendPath(Path, paths.front).hide()
|
|
|
|
points.frontWaistband = paths.frontTemp.intersects(tempWaistline)[0]
|
|
|
|
paths.front = paths.frontTemp.split(points.frontWaistband)[1].hide()
|
|
|
|
|
2023-11-27 00:39:47 +00:00
|
|
|
paths.front = paths.front.split(points.frontWaistband)[1].hide()
|
|
|
|
}
|
2023-11-28 06:31:40 +00:00
|
|
|
|
2023-11-30 04:32:20 +00:00
|
|
|
const kneeToUpperLeg = new Path().move(points.frontUpperLeg).line(points.frontKnee)
|
|
|
|
points.frontGusset = paths.front.intersects(kneeToUpperLeg)[0]
|
|
|
|
if (false == points.frontGusset.sitsRoughlyOn(paths.front.end())) {
|
|
|
|
paths.front = paths.front.split(points.frontGusset)[0].hide()
|
|
|
|
}
|
2023-11-21 05:58:27 +00:00
|
|
|
} else {
|
2023-12-16 17:57:37 +00:00
|
|
|
createGusset(points, paths, Path, store, 'front', gussetWidth, frontGussetLength)
|
2023-11-21 05:58:27 +00:00
|
|
|
}
|
2023-12-13 06:08:38 +00:00
|
|
|
|
|
|
|
if (backGusset) {
|
|
|
|
paths.backTempGusset = paths.back.offset(-1 * gussetWidth).hide()
|
|
|
|
|
|
|
|
const backHips = paths.back.shiftFractionAlong(0.99)
|
|
|
|
const backHipsAngle = points.backHips.angle(backHips) + 90
|
|
|
|
|
|
|
|
points.backUpperLegToHips = new Point(points.backHips.x, points.backUpperLeg.y)
|
|
|
|
points.backCircleMiddle = points.backHips.shiftFractionTowards(points.backUpperLegToHips, 0.5)
|
|
|
|
|
|
|
|
points.backCircleHipsCp1 = points.backHips.shift(
|
|
|
|
backHipsAngle,
|
|
|
|
measurements.hips * 0.25 * 0.5 * ease * backGussetWidth
|
|
|
|
)
|
|
|
|
|
|
|
|
points.backCircleUpperLegCp1 = points.backUpperLegToHips.shift(
|
|
|
|
0,
|
|
|
|
measurements.upperLeg * 0.25 * ease * backGussetWidth
|
|
|
|
)
|
|
|
|
|
|
|
|
paths.backTempCircle = new Path()
|
|
|
|
.move(points.backHips)
|
|
|
|
.curve(points.backCircleHipsCp1, points.backCircleUpperLegCp1, points.backUpperLeg)
|
|
|
|
.hide()
|
|
|
|
|
|
|
|
points.backCircleGusset = paths.backTempCircle.intersects(paths.backTempGusset)[1]
|
|
|
|
const pathBackGusset = paths.backTempGusset.split(points.backCircleGusset)
|
|
|
|
if (undefined !== pathBackGusset[1].ops) {
|
|
|
|
paths.backGusset = pathBackGusset[1].hide()
|
|
|
|
} else {
|
|
|
|
paths.backGusset = paths.backTempGusset.clone().hide()
|
|
|
|
}
|
|
|
|
|
|
|
|
paths.backCircle = paths.backTempCircle.split(points.backCircleGusset)[0].hide()
|
|
|
|
paths.backGusset = paths.backGusset.split(points.backGusset)[0].hide()
|
|
|
|
|
|
|
|
paths.back = new Path()
|
|
|
|
.move(points.backWaistband)
|
|
|
|
.line(points.backHips)
|
|
|
|
.join(paths.backCircle)
|
|
|
|
.join(paths.backGusset)
|
|
|
|
.hide()
|
|
|
|
|
2023-12-13 16:19:46 +00:00
|
|
|
paths.backTop = new Path().move(points.backWaistband).line(points.backHips).hide()
|
|
|
|
|
2023-12-13 06:08:38 +00:00
|
|
|
store.set('backGussetLength', paths.backGusset.length())
|
|
|
|
store.set('backCircleLength', paths.backCircle.length())
|
|
|
|
} else {
|
2023-12-16 17:57:37 +00:00
|
|
|
createGusset(points, paths, Path, store, 'back', gussetWidth, backGussetLength)
|
2023-12-13 06:08:38 +00:00
|
|
|
}
|
|
|
|
|
2023-11-21 05:58:27 +00:00
|
|
|
store.set('frontLength', paths.front.length())
|
2023-11-26 02:54:19 +00:00
|
|
|
;['front', 'back'].forEach((prefix) => {
|
2023-12-16 17:57:37 +00:00
|
|
|
createControlPoints(points, cpDistanceDivider, [
|
|
|
|
prefix + 'UpperLeg',
|
|
|
|
prefix + 'Knee',
|
|
|
|
prefix + 'Ankle',
|
|
|
|
])
|
2023-11-26 02:54:19 +00:00
|
|
|
})
|
2023-11-20 05:46:10 +00:00
|
|
|
|
2023-12-01 06:43:29 +00:00
|
|
|
paths.frontLeg = new Path()
|
|
|
|
.move(points.frontGusset)
|
|
|
|
._curve(points.frontKneeCp2, points.frontKnee)
|
|
|
|
.curve_(points.frontKneeCp1, points.frontAnkle)
|
|
|
|
.hide()
|
|
|
|
paths.backLeg = new Path()
|
|
|
|
.move(points.backGusset)
|
|
|
|
._curve(points.backKneeCp2, points.backKnee)
|
|
|
|
.curve_(points.backKneeCp1, points.backAnkle)
|
|
|
|
.hide()
|
|
|
|
|
|
|
|
points.centerBottom = points.centerInseam.shift(270, legLength)
|
|
|
|
if (points.centerBottom.y > points.centerAnkle.y) {
|
|
|
|
points.centerBottom.y = points.centerAnkle.y
|
|
|
|
}
|
|
|
|
const bottom = new Path()
|
|
|
|
.move(points.centerBottom.shift(180, measurements.seat))
|
|
|
|
.line(points.centerBottom.shift(0, measurements.seat))
|
2023-12-16 17:57:37 +00:00
|
|
|
const frontLeg = extendPath(Path, paths.frontLeg)
|
|
|
|
const backLeg = extendPath(Path, paths.backLeg)
|
2023-12-09 18:07:07 +00:00
|
|
|
|
|
|
|
points.frontBottom = frontLeg.intersects(bottom)[0]
|
|
|
|
points.backBottom = backLeg.intersects(bottom)[0]
|
2023-12-16 17:57:37 +00:00
|
|
|
points.backBottom.name = 'backBottom'
|
|
|
|
|
|
|
|
const flSplit = paths.frontLeg.split(points.frontBottom)
|
|
|
|
if (
|
|
|
|
false === points.frontBottom.sitsRoughlyOn(points.frontAnkle) &&
|
|
|
|
flSplit[0].ops !== undefined
|
|
|
|
) {
|
|
|
|
paths.frontLeg = flSplit[0].hide()
|
2023-12-01 06:43:29 +00:00
|
|
|
}
|
2023-12-16 17:57:37 +00:00
|
|
|
const blSplit = paths.backLeg.split(points.backBottom)
|
|
|
|
if (
|
|
|
|
false === points.backBottom.sitsRoughlyOn(points.backAnkle) &&
|
|
|
|
blSplit[0].ops !== undefined
|
|
|
|
) {
|
|
|
|
paths.backLeg = blSplit[0].hide()
|
2023-12-01 06:43:29 +00:00
|
|
|
}
|
|
|
|
|
2023-11-20 05:46:10 +00:00
|
|
|
paths.waist = new Path()
|
2023-11-24 18:57:55 +00:00
|
|
|
.move(points.frontWaistband)
|
|
|
|
.line(points.centerWaistband)
|
2023-12-13 06:08:38 +00:00
|
|
|
.curve(points.centerWaistbandCp, points.backWaistbandCp2, points.backWaistband)
|
2023-11-20 05:46:10 +00:00
|
|
|
.hide()
|
|
|
|
paths.ankle = new Path()
|
|
|
|
.move(points.backAnkle)
|
|
|
|
.line(points.centerAnkle)
|
|
|
|
.line(points.frontAnkle)
|
|
|
|
.hide()
|
2023-12-01 06:43:29 +00:00
|
|
|
paths.bottom = new Path().move(points.backBottom).line(points.frontBottom).hide()
|
2023-11-20 05:46:10 +00:00
|
|
|
|
2023-11-28 06:31:40 +00:00
|
|
|
store.set('waistLength', paths.waist.length())
|
2023-12-13 06:08:38 +00:00
|
|
|
store.set('waistLengthFront', points.frontWaistband.dist(points.centerWaistband))
|
|
|
|
store.set('waistLengthBack', store.get('waistLength') - store.get('waistLengthFront'))
|
2023-11-28 06:31:40 +00:00
|
|
|
|
2023-11-20 05:46:10 +00:00
|
|
|
return part
|
|
|
|
},
|
|
|
|
}
|