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

149 lines
4.7 KiB
JavaScript
Raw Normal View History

2023-10-19 15:24:06 +00:00
import { frontPoints as nobleFrontPoints } from '@freesewing/noble'
import { hidePresets } from '@freesewing/core'
import * as options from './options.mjs'
export const frontPoints = {
name: 'tristan.frontPoints',
from: nobleFrontPoints,
hide: hidePresets.HIDE_ALL,
options,
2023-10-27 04:43:09 +00:00
draft: ({
log,
measurements,
Point,
points,
Path,
paths,
snippets,
options,
macro,
utils,
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')
console.log({ dist: points.hps.dist(points.shoulder) })
console.log({ dist: points.shoulderDartInside.dist(points.hps) })
console.log({ dist: points.shoulderDartOutside.dist(points.shoulder) })
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
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-27 04:43:09 +00:00
console.log({ strapWidth: strapWidth })
2023-10-19 23:02:21 +00:00
2023-10-19 15:24:06 +00:00
console.log({ options: JSON.parse(JSON.stringify(options)) })
console.log({ paths: JSON.parse(JSON.stringify(paths)) })
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.shoulder = points.strapOutside
2023-10-19 15:24:06 +00:00
2023-10-19 23:02:21 +00:00
// .line(points.armhole)
// .curve(points.armholeCp2, points.armholePitchCp1, points.armholePitch)
// .curve_(points.armholePitchCp2, points.shoulder)
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-27 04:43:09 +00:00
points.armholeCutCp = points.armhole
.shiftFractionTowards(points.bustDartTip, options.armholeFrontIn)
.addCircle(4)
// points.armholeCutCp = points.armhole.shiftFractionTowards(
// points.cutSeamOutside,
// 1 - options.cutRoundnessFront
// ).addCircle(4)
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-27 04:43:09 +00:00
// points.strapOutsideCp = points.strapOutside.shiftFractionTowards(
// points.cutSeamOutside.shift(
// points.cutSeamOutside.angle(points.shoulderDartOutside) - 90,
// strapWidth / 2
// ),
// 1 - options.cutRoundnessFront
// )
2023-10-19 23:02:21 +00:00
const armHole = new Path()
.move(points.armhole)
.curve(points.armholeCp2, points.armholePitchCp1, points.armholePitch)
.curve_(points.armholePitchCp2, points.shoulder)
console.log({
intersects: armHole.intersects(
new Path()
.move(points.strapOutside)
.curve(points.strapOutsideCp, points.armholeCutCp, points.armhole)
).length,
})
2023-10-27 04:43:09 +00:00
// var iter = 0
// while (
// armHole.intersects(
// new Path()
// .move(points.strapOutside)
// .curve(points.strapOutsideCp, points.armholeCutCp, points.armhole)
// ).length != 0 &&
// ++iter < 250
// ) {
// points.armholeCutCp = points.armholeCutCp.shiftFractionTowards(points.cutSeamOutside, 0.05)
// }
// 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-19 15:24:06 +00:00
return part
},
}