1
0
Fork 0
freesewing/designs/tristan/src/frontpoints.mjs

140 lines
4.8 KiB
JavaScript
Raw Normal View History

2023-10-19 15:24:06 +00:00
import { frontPoints as nobleFrontPoints } from '@freesewing/noble'
2023-10-30 23:55:00 +00:00
import { pctBasedOn, hidePresets } from '@freesewing/core'
2023-10-19 15:24:06 +00:00
export const frontPoints = {
name: 'tristan.frontPoints',
from: nobleFrontPoints,
hide: hidePresets.HIDE_ALL,
2023-10-30 23:55:00 +00:00
options: {
// Static
armholeBackDepth: 0.6,
armholeBackIn: 0.6,
armholeDartPosition: 0.5,
armholeFrontDepth: 0.65,
armholeFrontIn: 0.2,
backArmholeCurvature: 0.63,
backArmholePitchDepth: 0.035,
backArmholeSlant: 5,
backDartHeight: 0.46,
backHemSlope: 2.5,
backNeckCutout: 0.06,
bustDartCurve: 1,
bustDartLength: 0.9,
dartPosition: 'shoulder',
frontArmholeCurvature: 0.63,
frontArmholePitchDepth: 0.29,
shoulderToShoulderCorrection: 0.995,
// Percentages
bustSpanEase: { pct: 0, min: -5, max: 20, ...pctBasedOn('bustSpan'), menu: 'fit' },
armholeDepth: { pct: 44, min: 38, max: 55, menu: 'style' },
cutDepthBack: { pct: 40, min: 5, max: 90, menu: 'style' },
cutDepthFront: { pct: 80, min: 0, max: 125, menu: 'style' },
cutRoundnessBack: { pct: 20, min: 0, max: 100, menu: 'style' },
cutRoundnessFront: { pct: 10, min: 0, max: 100, menu: 'style' },
shoulderDartPosition: { pct: 50, min: 10, max: 90, menu: 'style' },
strapWidth: { pct: 45, min: 5, max: 90, menu: 'style' },
upperDartLength: { pct: 90, min: 80, max: 95, menu: 'advanced' },
waistDartLength: { pct: 90, min: 75, max: 95, menu: 'advanced' },
// Options
// peplum: { bool: false, menu: 'style' },
// peplumSize: { pct: 10, min: 5, max: 50, menu: 'peplum' },
},
draft: ({ points, Path, paths, snippets, options, macro, store, part }) => {
2023-10-19 15:24:06 +00:00
const bCircle = 0.552284749831
2023-10-22 18:58:54 +00:00
// Hide Noble paths
2023-10-19 15:24:06 +00:00
for (const key of Object.keys(paths)) paths[key].hide()
for (const i in snippets) delete snippets[i]
2023-10-22 18:58:54 +00:00
// Remove macros from Noble
2023-10-19 15:24:06 +00:00
macro('rmtitle')
macro('rmscalebox')
2023-10-19 23:02:21 +00:00
const shoulderWidthInside = points.shoulderDartInside.dist(points.hps)
const shoulderWidthOutside = points.shoulderDartOutside.dist(points.shoulder)
let strapWidth = (shoulderWidthInside + shoulderWidthOutside) * options.strapWidth
2023-10-30 23:55:00 +00:00
console.log({
r: strapWidth / shoulderWidthOutside,
sw: shoulderWidthOutside,
strap: strapWidth,
})
2023-10-19 23:02:21 +00:00
if (strapWidth / 2 > shoulderWidthInside) {
strapWidth = shoulderWidthInside * 2
}
if (strapWidth / 2 > shoulderWidthOutside) {
strapWidth = shoulderWidthOutside * 2
}
2023-10-22 18:58:54 +00:00
store.set('strapWidth', strapWidth)
2023-10-19 15:24:06 +00:00
2023-10-19 23:02:21 +00:00
points.strapInside = points.shoulderDartInside.shiftTowards(points.hps, strapWidth / 2)
points.strapOutside = points.shoulderDartOutside.shiftTowards(points.shoulder, strapWidth / 2)
points.cfCut = points.cfNeck.shiftFractionTowards(points.cfBust, options.cutDepthFront)
2023-10-27 04:43:09 +00:00
console.log({ cut: points.cfNeck.dist(points.cfCut) })
2023-10-19 23:02:21 +00:00
points.cutSeamInside = new Path()
2023-10-19 15:24:06 +00:00
.move(points.waistDartLeft)
.curve(points.waistDartLeftCp, points.shoulderDartTipCpDownInside, points.shoulderDartTip)
.line(points.shoulderDartInside)
.intersectsY(points.cfCut.y)[0]
2023-10-19 23:02:21 +00:00
points.cutSeamOutside = new Path()
.move(points.waistDartRight)
.curve(points.waistCpUp, points.waistUpDartRightCpDown, points.waistUpDartRight)
.curve(
points.waistUpDartRightCpUp,
points.shoulderDartTipCpDownOutside,
points.shoulderDartOutside
2023-10-19 15:24:06 +00:00
)
2023-10-19 23:02:21 +00:00
.intersectsY(points.cfCut.y)[0]
2023-10-27 04:43:09 +00:00
.addCircle(6)
2023-10-19 23:02:21 +00:00
points.cfCutCp = points.cfCut.shiftFractionTowards(
points.cutSeamInside,
1 - options.cutRoundnessFront
)
points.strapInsideCp = points.strapInside.shiftFractionTowards(
points.cutSeamInside.shift(
points.cutSeamInside.angle(points.shoulderDartInside) + 90,
strapWidth / 2
),
1 - options.cutRoundnessFront
)
2023-10-30 23:55:00 +00:00
points.armholeCutCp = points.armhole.shiftFractionTowards(
points.bustDartTip,
options.armholeFrontIn
)
2023-10-19 23:02:21 +00:00
points.strapOutsideCp = points.strapOutside.shiftFractionTowards(
2023-10-27 04:43:09 +00:00
points.bustDartTip.shift(
2023-10-19 23:02:21 +00:00
points.cutSeamOutside.angle(points.shoulderDartOutside) - 90,
strapWidth / 2
),
2023-10-27 04:43:09 +00:00
options.armholeFrontDepth
2023-10-19 23:02:21 +00:00
)
2023-10-30 23:55:00 +00:00
if (points.strapOutsideCp.x > points.armholeDartCpBottom.x) {
points.strapOutsideCp.x = points.armholeDartCpBottom.x
}
if (points.strapOutsideCp.y > points.armholeDartCpBottom.y) {
points.strapOutsideCp.y = points.armholeDartCpBottom.y
}
2023-10-27 04:43:09 +00:00
// armhole adjustment
if (points.sideHem.y < points.waistDartRight.y) {
points.sideHem.y = points.waistDartRight.y
2023-10-19 23:02:21 +00:00
}
2023-10-30 23:55:00 +00:00
store.set('frontOutsideWaistLength', points.waistDartRight.dist(points.sideHem))
store.set('frontInsideWaistLength', points.waistDartLeft.dist(points.cfHem))
store.set('frontLength', points.cfNeck.dist(points.cfHem))
2023-10-19 15:24:06 +00:00
return part
},
}