fix(noble): Don't check var prior to initialization
This commit is contained in:
parent
ab38837816
commit
79f477854b
1 changed files with 20 additions and 16 deletions
|
@ -44,25 +44,29 @@ export default function (part) {
|
|||
points.shoulderDartCpUp = points.shoulderDart.shiftFractionTowards( points.dartTip, 1 - dartCpAdjustment)
|
||||
points.shoulderDartCpDown = points.shoulderDart.shiftFractionTowards( points.dartTip, 1 +dartCpAdjustment )
|
||||
|
||||
let iLength = (new Path()
|
||||
.move(points.dartBottomLeft)
|
||||
.curve(points.dartLeftCp, points.shoulderDartCpDown, points.dartTip)
|
||||
.curve(points.shoulderDartCpUp, points.shoulderDart, points.shoulderDart)).length();
|
||||
const length = {
|
||||
i: new Path()
|
||||
.move(points.dartBottomLeft)
|
||||
.curve(points.dartLeftCp, points.shoulderDartCpDown, points.dartTip)
|
||||
.curve(points.shoulderDartCpUp, points.shoulderDart, points.shoulderDart)
|
||||
.length()
|
||||
}
|
||||
|
||||
let iteration = 0
|
||||
let diff = 0
|
||||
let angle = 0
|
||||
do {
|
||||
angle = diff*( oLength > iLength ? -.1 : .1 )
|
||||
if (length?.o) angle = diff*( length.o > length.i ? -.1 : .1 )
|
||||
|
||||
points.dartBottomRight = points.dartBottomRight.rotate( angle, points.waistSide )
|
||||
|
||||
let oLength = (new Path()
|
||||
length.o = new Path()
|
||||
.move(points.shoulderDart)
|
||||
.curve(points.shoulderDart, points.shoulderDartCpUp, points.dartTip)
|
||||
.curve(points.shoulderDartCpDown, points.dartRightCp, points.dartBottomRight)).length();
|
||||
.curve(points.shoulderDartCpDown, points.dartRightCp, points.dartBottomRight)
|
||||
.length()
|
||||
|
||||
diff = oLength -iLength
|
||||
diff = length.o - length.i
|
||||
iteration ++
|
||||
|
||||
} while( diff < -.5 || diff > .5 && iteration < 100 )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue