1
0
Fork 0
freesewing/packages/jaeger/src/undersleeve.js

200 lines
5.1 KiB
JavaScript
Raw Normal View History

export default function (part) {
2019-08-03 15:03:33 +02:00
let {
paperless,
sa,
utils,
complete,
points,
measurements,
options,
macro,
paths,
2021-04-24 10:16:31 +02:00
Path,
2019-08-03 15:03:33 +02:00
} = part.shorthand()
2019-03-16 11:39:06 +01:00
// Vent
2019-08-03 15:03:33 +02:00
let slope = 15
let width = measurements.wrist * (1 + options.cuffEase) * options.sleeveVentWidth
2019-08-03 15:03:33 +02:00
points.ventFoldRight = points.usWristLeft.shiftOutwards(points.usWristRight, width)
points.ventHelper = points.usWristRight.shiftFractionTowards(
points.elbowRight,
options.sleeveVentLength
)
2019-03-16 11:39:06 +01:00
points.ventSlopeEnd = points.ventHelper
.shiftTowards(points.usWristRight, width)
2019-08-03 15:03:33 +02:00
.rotate(90, points.ventHelper)
2019-03-16 11:39:06 +01:00
points.ventSlopeStart = utils.beamsIntersect(
2019-08-03 15:03:33 +02:00
points.usWristRight,
points.elbowRight,
points.ventSlopeEnd,
points.ventHelper.rotate(-1 * slope, points.ventSlopeEnd)
)
2019-03-16 11:39:06 +01:00
// Hem
2019-08-03 15:03:33 +02:00
let hemSa = sa ? 3 * sa : 30
2019-03-16 11:39:06 +01:00
points.hemHelperLeft = points.usWristLeft
.shiftTowards(points.usWristRight, hemSa)
2019-08-03 15:03:33 +02:00
.rotate(90, points.usWristLeft)
2019-03-16 11:39:06 +01:00
points.hemHelperRight = points.usWristRight
.shiftTowards(points.usWristLeft, hemSa)
2019-08-03 15:03:33 +02:00
.rotate(-90, points.usWristRight)
2019-03-16 11:39:06 +01:00
points.hemLeftIntersection = utils.beamsIntersect(
2019-08-03 15:03:33 +02:00
points.hemHelperLeft,
points.hemHelperRight,
points.usWristLeft,
points.usElbowLeft
)
2019-03-16 11:39:06 +01:00
points.hemRightIntersection = utils.beamsIntersect(
2019-08-03 15:03:33 +02:00
points.hemHelperLeft,
points.hemHelperRight,
points.usWristRight,
points.elbowRight
)
2019-03-16 11:39:06 +01:00
points.hemVentIntersection = utils.beamsIntersect(
2019-08-03 15:03:33 +02:00
points.hemHelperLeft,
points.hemHelperRight,
points.ventFoldRight,
points.ventSlopeEnd
)
points.hemLeft = points.hemLeftIntersection.rotate(
points.usWristLeft.angle(points.hemLeftIntersection) * -2,
points.usWristLeft
)
points.hemRight = points.hemRightIntersection.rotate(
points.usWristRight.angle(points.hemRightIntersection) * -2,
points.usWristRight
)
points.ventRight = points.hemVentIntersection.rotate(
points.ventFoldRight.angle(points.hemVentIntersection) * -2,
points.ventFoldRight
)
2019-03-16 11:39:06 +01:00
// Clean up - Remove this and uncomment paths below to understand what's going on
2019-08-03 15:03:33 +02:00
for (let i of Object.keys(paths)) delete paths[i]
2019-03-16 11:39:06 +01:00
// Paths
paths.seam = new Path()
.move(points.ventFoldRight)
.line(points.ventSlopeEnd)
.line(points.ventSlopeStart)
.line(points.elbowRight)
.curve(points.elbowRightCpTop, points.usRightEdgeCpBottom, points.usRightEdge)
.curve_(points.usRightEdgeCpTop, points.usTip)
.curve(points.usTipCpBottom, points.usLeftEdgeCpRight, points.usLeftEdgeRight)
2019-03-16 17:34:17 +01:00
.line(points.usLeftEdge)
2019-03-16 11:39:06 +01:00
._curve(points.usElbowLeftCpTop, points.usElbowLeft)
.line(points.usWristLeft)
2019-03-16 17:34:17 +01:00
.line(points.hemLeft)
.line(points.ventRight)
2019-03-16 11:39:06 +01:00
.line(points.ventFoldRight)
.close()
2019-08-03 15:03:33 +02:00
.attr('class', 'fabric')
2019-03-16 11:39:06 +01:00
paths.ventHint = new Path()
.move(points.ventSlopeStart)
.line(points.usWristRight)
2019-08-03 15:03:33 +02:00
.attr('class', 'stroke-sm help')
2019-03-16 11:39:06 +01:00
paths.hem = new Path()
.move(points.usWristLeft)
.line(points.ventFoldRight)
2019-08-03 15:03:33 +02:00
.attr('class', 'fabric lashed')
2019-03-16 11:39:06 +01:00
2019-03-16 17:34:17 +01:00
if (complete) {
// Notches
2019-08-03 15:03:33 +02:00
macro('sprinkle', {
snippet: 'notch',
2021-04-24 10:16:31 +02:00
on: ['top', 'usElbowLeft', 'elbowRight'],
2019-08-03 15:03:33 +02:00
})
2019-03-16 17:34:17 +01:00
// Title
2019-08-03 15:03:33 +02:00
points.title = points.tsLeftEdge.shiftFractionTowards(points.tsRightEdge, 0.5)
macro('title', {
2019-03-16 17:34:17 +01:00
at: points.title,
nr: 5,
2021-04-24 10:16:31 +02:00
title: 'underSleeve',
2019-08-03 15:03:33 +02:00
})
2019-03-16 17:34:17 +01:00
// Grainline
2019-08-03 15:03:33 +02:00
macro('grainline', {
2019-03-16 17:34:17 +01:00
from: points.boxBottom,
2021-04-24 10:16:31 +02:00
to: points.armCenter,
2019-08-03 15:03:33 +02:00
})
2019-03-16 17:34:17 +01:00
2019-08-03 15:03:33 +02:00
if (sa) paths.sa = paths.seam.offset(sa).attr('class', 'fabric sa')
2019-03-17 16:53:09 +01:00
if (paperless) {
2019-08-03 15:03:33 +02:00
macro('ld', {
2019-03-17 16:53:09 +01:00
from: points.usWristLeft,
to: points.usWristRight,
2021-04-24 10:16:31 +02:00
d: 15,
2019-08-03 15:03:33 +02:00
})
macro('ld', {
2019-03-17 16:53:09 +01:00
from: points.usWristLeft,
to: points.ventFoldRight,
2021-04-24 10:16:31 +02:00
d: 30,
2019-08-03 15:03:33 +02:00
})
macro('ld', {
2019-03-17 16:53:09 +01:00
from: points.hemLeft,
to: points.ventRight,
2021-04-24 10:16:31 +02:00
d: -15 - sa,
2019-08-03 15:03:33 +02:00
})
macro('ld', {
2019-03-17 16:53:09 +01:00
from: points.hemLeft,
to: points.usWristLeft,
2021-04-24 10:16:31 +02:00
d: 15 + sa,
2019-08-03 15:03:33 +02:00
})
macro('ld', {
2019-03-17 16:53:09 +01:00
from: points.usWristRight,
to: points.ventSlopeStart,
2021-04-24 10:16:31 +02:00
d: 15,
2019-08-03 15:03:33 +02:00
})
macro('ld', {
2019-03-17 16:53:09 +01:00
from: points.ventFoldRight,
to: points.ventSlopeEnd,
2021-04-24 10:16:31 +02:00
d: 15,
2019-08-03 15:03:33 +02:00
})
macro('ld', {
2019-03-17 16:53:09 +01:00
from: points.usWristRight,
to: points.ventFoldRight,
2021-04-24 10:16:31 +02:00
d: -15,
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2019-03-17 16:53:09 +01:00
from: points.usWristLeft,
to: points.usElbowLeft,
2021-04-24 10:16:31 +02:00
x: points.usLeftEdge.x - sa - 15,
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2019-03-17 16:53:09 +01:00
from: points.usWristLeft,
to: points.usLeftEdge,
2021-04-24 10:16:31 +02:00
x: points.usLeftEdge.x - sa - 30,
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2019-03-17 16:53:09 +01:00
from: points.usLeftEdge,
to: points.usTip,
2021-04-24 10:16:31 +02:00
x: points.usLeftEdge.x - sa - 30,
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2019-03-17 16:53:09 +01:00
from: points.usWristLeft,
to: points.usTip,
2021-04-24 10:16:31 +02:00
x: points.usLeftEdge.x - sa - 45,
2019-08-03 15:03:33 +02:00
})
macro('ld', {
2019-03-17 16:53:09 +01:00
from: points.usElbowLeft,
2021-04-24 10:16:31 +02:00
to: points.elbowRight,
2019-08-03 15:03:33 +02:00
})
macro('hd', {
2019-03-17 16:53:09 +01:00
from: points.usLeftEdge,
to: points.usTip,
2021-04-24 10:16:31 +02:00
y: points.usTip.y - sa - 15,
2019-08-03 15:03:33 +02:00
})
macro('hd', {
2019-03-17 16:53:09 +01:00
from: points.usLeftEdge,
to: points.elbowRight,
2021-04-24 10:16:31 +02:00
y: points.usTip.y - sa - 30,
2019-08-03 15:03:33 +02:00
})
2019-03-17 16:53:09 +01:00
}
2019-03-16 17:34:17 +01:00
}
2019-08-03 15:03:33 +02:00
return part
2019-03-16 11:39:06 +01:00
}