From adab3bce3dfd9faceed8b07e75243a770f83db27 Mon Sep 17 00:00:00 2001 From: Joost De Cock Date: Fri, 10 Aug 2018 17:44:29 +0200 Subject: [PATCH] construction: Changed point names according to best practices --- packages/brian/src/base.js | 14 +++++++------- packages/brian/src/front.js | 4 ++-- packages/brian/src/shared.js | 34 +++++++++++++--------------------- 3 files changed, 22 insertions(+), 30 deletions(-) diff --git a/packages/brian/src/base.js b/packages/brian/src/base.js index 63231fc2d1f..af6bd83284c 100644 --- a/packages/brian/src/base.js +++ b/packages/brian/src/base.js @@ -77,27 +77,27 @@ var base = { points.armholePitch ); points.armholeHollow = points._tmp1.shiftFractionTowards(points._tmp3, 0.5); - points.armholeCp1 = points.armhole.shift( + points.armholeCp2 = points.armhole.shift( 180, points._tmp1.dx(points.armhole) / 4 ); - points.armholeCp2 = points.armholeHollow.shift( + points.armholeHollowCp1 = points.armholeHollow.shift( -45, points.armholeHollow.dy(points.armhole) / 2 ); - points.armholeHollowCp1 = points.armholeHollow.shift( + points.armholeHollowCp2 = points.armholeHollow.shift( 135, points.armholePitch.dx(points.armholeHollow) ); - points.armholeHollowCp2 = points.armholePitch.shift( + points.armholePitchCp1 = points.armholePitch.shift( -90, points.armholePitch.dy(points.armholeHollow) / 2 ); - points.armholePitchCp1 = points.armholePitch.shift( + points.armholePitchCp2 = points.armholePitch.shift( 90, points.shoulder.dy(points.armholePitch) / 2 ); - points.armholePitchCp2 = points.shoulder + points.shoulderCp1 = points.shoulder .shiftTowards(points.neck, points.shoulder.dy(points.armholePitch) / 5) .rotate(90, points.shoulder); @@ -105,7 +105,7 @@ var base = { points._tmp4 = points.neck .shiftTowards(points.shoulder, 10) .rotate(-90, points.neck); - points.neckCp1 = freesewing.utils.beamCrossesY( + points.neckCp2 = freesewing.utils.beamCrossesY( points.neck, points._tmp4, points.cbNeck.y diff --git a/packages/brian/src/front.js b/packages/brian/src/front.js index 9f7e6753241..c28fbc29959 100644 --- a/packages/brian/src/front.js +++ b/packages/brian/src/front.js @@ -11,9 +11,9 @@ var front = { // Cut arm a bit deeper at the front let deeper = measurements.chestCircumference * options.frontArmholeDeeper; - points.armholeHollowCp2.x -= deeper; - points.armholePitch.x -= deeper; points.armholePitchCp1.x -= deeper; + points.armholePitch.x -= deeper; + points.armholePitchCp2.x -= deeper; // Rename cb (center back) to cf (center front) for (let key of ["Neck", "Shoulder", "Armhole", "Waist", "Hips"]) { diff --git a/packages/brian/src/shared.js b/packages/brian/src/shared.js index acfd26fab20..32f2fac8a2b 100644 --- a/packages/brian/src/shared.js +++ b/packages/brian/src/shared.js @@ -10,18 +10,14 @@ export function seamLine(side, points, Path) { path .line(points.hips) .line(points.armhole) - .curve(points.armholeCp1, points.armholeCp2, points.armholeHollow) - .curve( - points.armholeHollowCp1, - points.armholeHollowCp2, - points.armholePitch - ) - .curve(points.armholePitchCp1, points.armholePitchCp2, points.shoulder) + .curve(points.armholeCp2, points.armholeHollowCp1, points.armholeHollow) + .curve(points.armholeHollowCp2, points.armholePitchCp1, points.armholePitch) + .curve(points.armholePitchCp2, points.shoulderCp1, points.shoulder) .line(points.neck); if (side === "back") { - path.curve(points.neckCp1, points.cbNeck, points.cbNeck); + path.curve(points.neckCp2, points.cbNeck, points.cbNeck); } else { - path.curve(points.neckCp1, points.neckCp2, points.cfNeck); + path.curve(points.neckCp2, points.cfNeck, points.cfNeck); } path.close().attr("class", "fabric"); @@ -31,20 +27,16 @@ export function seamLine(side, points, Path) { export function armholeLength(points, Path) { return new Path() .move(points.armhole) - .curve(points.armholeCp1, points.armholeCp2, points.armholeHollow) - .curve( - points.armholeHollowCp1, - points.armholeHollowCp2, - points.armholePitch - ) - .curve(points.armholePitchCp1, points.armholePitchCp2, points.shoulder) + .curve(points.armholeCp2, points.armholeHollowCp1, points.armholeHollow) + .curve(points.armholeHollowCp2, points.armholePitchCp1, points.armholePitch) + .curve(points.armholePitchCp2, points.shoulderCp1, points.shoulder) .length(); } export function shoulderToArmholePitch(points, Path) { return new Path() .move(points.armholePitch) - .curve(points.armholePitchCp1, points.armholePitchCp2, points.shoulder) + .curve(points.armholePitchCp2, points.shoulderCp1, points.shoulder) .length(); } @@ -52,19 +44,19 @@ export function dimensions(macro, points, Path, sa) { macro("pd", { path: new Path() .move(points.armhole) - .curve(points.armholeCp1, points.armholeCp2, points.armholeHollow) + .curve(points.armholeCp1, points.armholeCp1, points.armholeHollow) .curve( points.armholeHollowCp1, - points.armholeHollowCp2, + points.armholeHollowCp1, points.armholePitch ) - .curve(points.armholePitchCp1, points.armholePitchCp2, points.shoulder), + .curve(points.shoulderCp1, points.shoulderCp1, points.shoulder), d: sa + 15 }); macro("pd", { path: new Path() .move(points.armholePitch) - .curve(points.armholePitchCp1, points.armholePitchCp2, points.shoulder), + .curve(points.shoulderCp1, points.shoulderCp1, points.shoulder), d: -15 }); macro("vd", {