fix(charlie): Support non-human sizes. Closes #1313
This commit is contained in:
parent
d13d0118e9
commit
631b33d636
13 changed files with 53 additions and 11 deletions
|
@ -103,7 +103,7 @@ export default {
|
|||
|
||||
// Style (from Titan)
|
||||
waistHeight: { pct: -4, min: -50, max: 30 },
|
||||
waistbandWidth: { mm: 40, min: 20, max: 60 },
|
||||
waistbandWidth: { pct: 3.5, min: 2, max: 5 },
|
||||
lengthBonus: { pct: 2, min: -20, max: 10 },
|
||||
crotchDrop: { pct: 2, min: 0, max: 15 },
|
||||
|
||||
|
|
|
@ -16,6 +16,9 @@ export default (part) => {
|
|||
points.leftNotch = new Point(points.leftNotch.x, points.midRight.y)
|
||||
points.rightNotch = points.leftNotch.flipX()
|
||||
|
||||
// Anchor for sampling/grid
|
||||
points.anchor = points.topLeft.shiftFractionTowards(points.topRight, 0.5)
|
||||
|
||||
paths.seam = new Path()
|
||||
.move(points.topLeft)
|
||||
.line(points.bottomLeft)
|
||||
|
|
|
@ -16,6 +16,9 @@ export default (part) => {
|
|||
points.leftNotch = new Point(points.leftNotch.x, points.midRight.y)
|
||||
points.rightNotch = points.leftNotch.flipX()
|
||||
|
||||
// Anchor for sampling/grid
|
||||
points.anchor = points.topLeft.shiftFractionTowards(points.topRight, 0.5)
|
||||
|
||||
paths.seam = new Path()
|
||||
.move(points.topLeft)
|
||||
.line(points.bottomLeft)
|
||||
|
|
|
@ -22,6 +22,9 @@ export default (part) => {
|
|||
)
|
||||
points.bottomRight = points.bottomLeft.flipX()
|
||||
|
||||
// Anchor for sampling/grid
|
||||
points.anchor = points.waistbandLeft.shiftFractionTowards(points.waistbandRight, 0.5)
|
||||
|
||||
paths.seam = new Path()
|
||||
.move(points.waistbandRight)
|
||||
.line(points.waistbandLeft)
|
||||
|
|
|
@ -126,6 +126,10 @@ export default (part) => {
|
|||
points.slantBottom.dist(points.slantCurveCp1) + store.get('slantLength')
|
||||
)
|
||||
|
||||
// Anchor for sampling/grid
|
||||
// This breaks the samples for reason not clear. See #
|
||||
// points.anchor = points.fork.clone()
|
||||
|
||||
paths.saBase = drawPath()
|
||||
paths.seam = paths.saBase
|
||||
.insop('dart', new Path().line(points.pocketCenter))
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
export default (part) => {
|
||||
// Shorthand
|
||||
let { points, Point, paths, Path, options, complete, paperless, macro, sa } = part.shorthand()
|
||||
let { store, points, Point, paths, Path, options, complete, paperless, macro, sa } = part.shorthand()
|
||||
|
||||
let count = options.beltLoops
|
||||
let length = options.waistbandWidth * 2.5 * count
|
||||
let width = options.waistbandWidth / 4
|
||||
let length = store.get('waistbandWidth') * 2.5 * count
|
||||
let width = store.get('waistbandWidth') / 4
|
||||
|
||||
points.topLeft = new Point(0, 0)
|
||||
points.topRight = new Point(width * 2.8, 0)
|
||||
|
|
|
@ -11,6 +11,9 @@ export default (part) => {
|
|||
if (id !== 'flyTop') points[id] = points[id].rotate(angle, points.flyTop)
|
||||
}
|
||||
|
||||
// Anchor for sampling/grid
|
||||
points.anchor = points.flyTop.clone()
|
||||
|
||||
// Paths
|
||||
paths.saBase = new Path()
|
||||
.move(points.flyCorner)
|
||||
|
|
|
@ -6,6 +6,9 @@ export default (part) => {
|
|||
for (let id in paths) delete paths[id]
|
||||
for (let id in snippets) delete snippets[id]
|
||||
|
||||
// Anchor for sampling/grid
|
||||
points.anchor = points.flyTop.clone()
|
||||
|
||||
paths.saBase = new Path()
|
||||
.move(points.fork)
|
||||
.curve(points.crotchSeamCurveCp1, points.crotchSeamCurveCp2, points.crotchSeamCurveStart)
|
||||
|
|
|
@ -6,6 +6,9 @@ export default (part) => {
|
|||
for (let id in paths) delete paths[id]
|
||||
for (let id in snippets) delete snippets[id]
|
||||
|
||||
// Anchor for sampling/grid
|
||||
points.anchor = points.pocketFacingTop.clone()
|
||||
|
||||
paths.seam = new Path()
|
||||
.move(points.pocketFacingTop)
|
||||
.line(points.slantTop)
|
||||
|
|
|
@ -6,6 +6,9 @@ export default (part) => {
|
|||
for (let id in paths) delete paths[id]
|
||||
for (let id in snippets) delete snippets[id]
|
||||
|
||||
// Anchor for sampling/grid
|
||||
points.anchor = points.pocketbagTopRight.clone()
|
||||
|
||||
// Paths
|
||||
paths.saBase = new Path()
|
||||
.move(points.pocketbagTopRight)
|
||||
|
|
|
@ -34,6 +34,7 @@ export default (part) => {
|
|||
snippets,
|
||||
Snippet,
|
||||
sa,
|
||||
raise
|
||||
} = part.shorthand()
|
||||
|
||||
// Helper object holding the Titan side seam path
|
||||
|
@ -48,6 +49,16 @@ export default (part) => {
|
|||
.curve(points.seatOutCp2, points.kneeOutCp1, points.floorOut)
|
||||
|
||||
// Draw fly J-seam
|
||||
const flyBottom = utils.curveIntersectsY(
|
||||
points.crotchSeamCurveStart,
|
||||
points.crotchSeamCurveCp2,
|
||||
points.crotchSeamCurveCp1,
|
||||
points.fork,
|
||||
points.cfSeat.shiftFractionTowards(points.crotchSeamCurveCp2, options.flyLength).y
|
||||
)
|
||||
if (flyBottom) points.flyBottom = flyBottom
|
||||
else raise.error('Unable to locate the fly bottom. This draft will fail.')
|
||||
|
||||
points.flyBottom = utils.curveIntersectsY(
|
||||
points.crotchSeamCurveStart,
|
||||
points.crotchSeamCurveCp2,
|
||||
|
@ -143,6 +154,9 @@ export default (part) => {
|
|||
)
|
||||
.pop()
|
||||
|
||||
// Anchor for sampling/grid
|
||||
points.anchor = points.fork.clone()
|
||||
|
||||
// Draw path
|
||||
paths.seam = drawPath().close().attr('class', 'fabric')
|
||||
|
||||
|
|
|
@ -33,9 +33,9 @@ export default (part) => {
|
|||
points.cbBottom = points.cfLeftBottom.rotate(0.5 * angle, points.center)
|
||||
points.cfRightBottom = points.cfLeftBottom.rotate(angle, points.center)
|
||||
|
||||
points.cfLeftTop = points.cfLeftBottom.shiftTowards(points.center, options.waistbandWidth)
|
||||
points.cfLeftTop = points.cfLeftBottom.shiftTowards(points.center, store.get('waistbandWidth'))
|
||||
points.cbTop = points.cfLeftTop.rotate(0.5 * angle, points.center)
|
||||
points.cfRightTop = points.cfRightBottom.shiftTowards(points.center, options.waistbandWidth)
|
||||
points.cfRightTop = points.cfRightBottom.shiftTowards(points.center, store.get('waistbandWidth'))
|
||||
|
||||
// Calculate control points for circle arc
|
||||
// https://math.stackexchange.com/questions/873224/calculate-control-points-of-cubic-bezier-curve-approximating-a-part-of-a-circle
|
||||
|
@ -44,8 +44,8 @@ export default (part) => {
|
|||
points.cfLeftBottomCp = points.cfLeftBottom.shift(90, a * radius)
|
||||
points.cfRightBottomCp = points.cfRightBottom.shift(angle - 90, a * radius)
|
||||
|
||||
points.cfLeftTopCp = points.cfLeftTop.shift(90, a * (radius - options.waistbandWidth))
|
||||
points.cfRightTopCp = points.cfRightTop.shift(angle - 90, a * (radius - options.waistbandWidth))
|
||||
points.cfLeftTopCp = points.cfLeftTop.shift(90, a * (radius - store.get('waistbandWidth')))
|
||||
points.cfRightTopCp = points.cfRightTop.shift(angle - 90, a * (radius - store.get('waistbandWidth')))
|
||||
|
||||
// Add fly underlap
|
||||
points.edgeRightTop = points.cfRightTop.shiftTowards(
|
||||
|
@ -132,11 +132,11 @@ export default (part) => {
|
|||
.attr('data-text', 'leftSide')
|
||||
.attr('data-text-class', 'center')
|
||||
|
||||
let buttonScale = options.waistbandWidth / 14
|
||||
let buttonScale = store.get('waistbandWidth') / 14
|
||||
points.button = points.edgeRightBottom.shiftFractionTowards(points.cfRightTop, 0.6)
|
||||
snippets.button = new Snippet('button', points.button).attr('data-scale', buttonScale)
|
||||
points.buttonhole = new Point(
|
||||
points.cfLeftTop.x + 0.4 * options.waistbandWidth,
|
||||
points.cfLeftTop.x + 0.4 * store.get('waistbandWidth'),
|
||||
points.cfLeftTop.y - store.get('waistbandFly') * 0.4
|
||||
)
|
||||
snippets.buttonhole = new Snippet('buttonhole-start', points.buttonhole).attr(
|
||||
|
|
|
@ -13,14 +13,17 @@ export default (part) => {
|
|||
snippets,
|
||||
Snippet,
|
||||
sa,
|
||||
measurements,
|
||||
} = part.shorthand()
|
||||
|
||||
store.set('waistbandWidth', measurements.waistToFloor * options.waistbandWidth)
|
||||
|
||||
if (options.waistbandCurve > 0) {
|
||||
return part
|
||||
}
|
||||
|
||||
points.topLeft = new Point(0, 0)
|
||||
points.top = new Point(options.waistbandWidth, 0)
|
||||
points.top = new Point(store.get('waistbandWidth'), 0)
|
||||
points.topRight = new Point(points.top.x * 2, 0)
|
||||
points.bottomLeft = new Point(
|
||||
0,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue