1
0
Fork 0
freesewing/designs/jaeger/src/side.mjs

173 lines
4.5 KiB
JavaScript
Raw Normal View History

2022-09-05 18:47:21 +02:00
import { frontBase } from './frontbase.mjs'
import { backBase } from './backbase.mjs'
import { backVent, backVentLength } from './options.mjs'
2022-09-11 15:48:48 +02:00
function jaegerSide({
paperless,
sa,
snippets,
Snippet,
utils,
complete,
points,
measurements,
options,
macro,
paths,
Path,
part,
}) {
2019-03-16 11:39:06 +01:00
// Double back vent
if (options.backVent === 2) {
let ventY = points.bsHips.y - points.bsWaistCp1.dy(points.bsHips) * options.backVentLength
2019-03-16 11:39:06 +01:00
// Vent tip
points.ventStart = utils.curveIntersectsY(
points.bsHips,
points.bsHipsCp2,
points.bsWaistCp1,
points.bsWaist,
ventY
2019-08-03 15:03:33 +02:00
)
2019-03-16 11:39:06 +01:00
paths.ventBase = new Path()
.move(points.bsWaist)
.curve(points.bsWaistCp1, points.bsHipsCp2, points.bsHips)
.split(points.ventStart)
.pop()
2019-08-03 15:03:33 +02:00
.line(points.bsHem)
paths.vent = paths.ventBase.offset(measurements.neck / -10)
2019-03-16 11:39:06 +01:00
points.ventSlopeStart = utils.lineIntersectsCurve(
paths.vent.start(),
paths.vent.start().shift(170, measurements.neck / 5),
2019-03-16 11:39:06 +01:00
points.bsHips,
points.bsHipsCp2,
points.bsWaistCp1,
points.bsWaist
2019-08-03 15:03:33 +02:00
)
2019-03-16 11:39:06 +01:00
// Mirror slope on vent
2019-08-03 15:03:33 +02:00
points.ventHem = utils
.beamIntersectsX(points.sideHem, paths.vent.end(), paths.vent.end().flipX(points.bsHem).x)
.flipX(points.bsHem)
2019-03-16 11:39:06 +01:00
}
// Clean up - Remove this to understand what's going on
2019-08-03 15:03:33 +02:00
for (let i of Object.keys(paths)) if (i !== 'vent') delete paths[i]
for (let i of Object.keys(snippets)) delete snippets[i]
2019-03-16 11:39:06 +01:00
// Anchor for sampling
points.anchor = points.sideHem.clone()
2019-03-16 11:39:06 +01:00
// Paths
2019-08-03 15:03:33 +02:00
paths.hemBase = new Path().move(points.sideHem).line(points.bsHem)
2019-03-16 11:39:06 +01:00
if (options.backVent === 2) {
2019-08-03 15:03:33 +02:00
paths.hemBase.line(points.ventHem).line(paths.vent.end())
paths.saBase = paths.vent
.clone()
2019-03-16 11:39:06 +01:00
.reverse()
.line(points.ventSlopeStart)
2019-08-03 15:03:33 +02:00
.join(
new Path()
.move(points.bsHips)
.curve(points.bsHipsCp2, points.bsWaistCp1, points.bsWaist)
.split(points.ventSlopeStart)
.pop()
)
2019-03-16 11:39:06 +01:00
} else {
paths.saBase = new Path()
.move(points.bsHem)
.line(points.bsHips)
2019-08-03 15:03:33 +02:00
.curve(points.bsHipsCp2, points.bsWaistCp1, points.bsWaist)
2019-03-16 11:39:06 +01:00
}
paths.saBase = paths.saBase
.curve_(points.bsWaistCp2, points.bsArmholeHollow)
.curve(points.bsArmholeHollowCp1, points.bsArmholeCp2, points.sideArmhole)
.curve(points.sideArmholeCp2, points.sideSplitCp1, points.fsArmhole)
._curve(points.sideWaistCp2, points.sideWaist)
.curve(points.sideWaistCp1, points.sideHipsCp2, points.sideHips)
.line(points.sideHem)
paths.seam = paths.saBase.clone().join(paths.hemBase).close().attr('class', 'fabric')
2019-03-16 11:39:06 +01:00
2019-03-16 17:19:04 +01:00
if (complete) {
// Logo
2019-08-03 15:03:33 +02:00
points.logo = points.sideHips.shiftFractionTowards(points.bsHips, 0.5)
snippets.logo = new Snippet('logo', points.logo)
2019-03-16 17:19:04 +01:00
// Notches
2019-08-03 15:03:33 +02:00
macro('sprinkle', {
snippet: 'notch',
2021-04-24 10:16:31 +02:00
on: ['sideWaist', 'bsWaist'],
2019-08-03 15:03:33 +02:00
})
points.title = points.sideWaistCp2.shiftFractionTowards(points.bsWaistCp2, 0.5)
macro('title', {
2019-03-16 17:19:04 +01:00
at: points.title,
nr: 3,
2021-04-24 10:16:31 +02:00
title: 'side',
2019-08-03 15:03:33 +02:00
})
2019-03-16 17:19:04 +01:00
if (sa) {
paths.sa = paths.saBase
.clone()
.offset(sa)
2019-08-03 15:03:33 +02:00
.join(paths.hemBase.offset(sa * 3))
2019-03-16 17:19:04 +01:00
.close()
2019-08-03 15:03:33 +02:00
.attr('class', 'fabric sa')
2019-03-16 17:19:04 +01:00
}
2019-03-17 15:47:49 +01:00
if (paperless) {
2019-08-03 15:03:33 +02:00
macro('ld', {
2019-03-17 15:47:49 +01:00
from: points.sideWaist,
2021-04-24 10:16:31 +02:00
to: points.bsWaist,
2019-08-03 15:03:33 +02:00
})
macro('hd', {
2019-03-17 15:47:49 +01:00
from: points.sideHem,
2019-08-03 15:03:33 +02:00
to: points.bsHem,
2021-04-24 10:16:31 +02:00
y: points.sideHem.y + 3 * sa + 15,
2019-08-03 15:03:33 +02:00
})
macro('hd', {
2019-03-17 15:47:49 +01:00
from: points.fsArmhole,
2019-08-03 15:03:33 +02:00
to: points.bsArmholeHollow,
2021-04-24 10:16:31 +02:00
y: points.bsArmholeHollow.y - sa - 15,
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2019-03-17 15:47:49 +01:00
from: points.bsHem,
2019-08-03 15:03:33 +02:00
to: points.bsHips,
2021-04-24 10:16:31 +02:00
x: points.bsHips.x + sa + 15,
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2019-03-17 15:47:49 +01:00
from: points.bsHem,
2019-08-03 15:03:33 +02:00
to: points.bsWaist,
2021-04-24 10:16:31 +02:00
x: points.bsHips.x + sa + 30,
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2019-03-17 15:47:49 +01:00
from: points.bsHem,
2019-08-03 15:03:33 +02:00
to: points.bsArmholeHollow,
2021-04-24 10:16:31 +02:00
x: points.bsHips.x + sa + 45,
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2019-03-17 15:47:49 +01:00
from: points.sideHem,
2019-08-03 15:03:33 +02:00
to: points.bsArmholeHollow,
2021-04-24 10:16:31 +02:00
x: points.bsHips.x + sa + 60,
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2019-03-17 15:47:49 +01:00
from: points.sideHem,
2019-08-03 15:03:33 +02:00
to: points.sideWaist,
2021-04-24 10:16:31 +02:00
x: points.sideHem.x - sa - 15,
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2019-03-17 15:47:49 +01:00
from: points.sideWaist,
2019-08-03 15:03:33 +02:00
to: points.fsArmhole,
2021-04-24 10:16:31 +02:00
x: points.sideHem.x - sa - 15,
2019-08-03 15:03:33 +02:00
})
2019-03-17 15:47:49 +01:00
}
2019-03-16 17:19:04 +01:00
}
2019-08-03 15:03:33 +02:00
return part
2019-03-16 11:39:06 +01:00
}
2022-09-05 18:47:21 +02:00
export const side = {
name: 'jaeger.side',
from: frontBase,
after: backBase,
options: { backVent, backVentLength },
draft: jaegerSide,
}