2020-06-28 12:27:34 +02:00
|
|
|
export default function (part) {
|
2019-08-03 15:03:33 +02:00
|
|
|
let { Point, points, Path, paths, measurements, options } = part.shorthand()
|
2019-05-30 21:19:06 +02:00
|
|
|
|
2019-08-03 15:03:33 +02:00
|
|
|
let tweak = 1
|
2020-06-28 12:27:34 +02:00
|
|
|
let target = (measurements.head * options.neckRatio) / 4
|
2019-08-03 15:03:33 +02:00
|
|
|
let delta
|
2019-05-30 21:19:06 +02:00
|
|
|
do {
|
2020-06-28 12:27:34 +02:00
|
|
|
points.right = new Point((tweak * measurements.head) / 10, 0)
|
|
|
|
points.bottom = new Point(0, (tweak * measurements.head) / 12)
|
2019-05-30 21:19:06 +02:00
|
|
|
|
2019-08-03 15:03:33 +02:00
|
|
|
points.rightCp1 = points.right.shift(90, points.bottom.dy(points.right) / 2)
|
|
|
|
points.bottomCp2 = points.bottom.shift(0, points.bottom.dx(points.right) / 2)
|
2019-05-30 21:19:06 +02:00
|
|
|
|
|
|
|
paths.neck = new Path()
|
|
|
|
.move(points.right)
|
2019-08-03 15:03:33 +02:00
|
|
|
.curve(points.rightCp1, points.bottomCp2, points.bottom)
|
2019-05-30 21:19:06 +02:00
|
|
|
|
2019-08-03 15:03:33 +02:00
|
|
|
delta = paths.neck.length() - target
|
|
|
|
if (delta > 0) tweak = tweak * 0.99
|
|
|
|
else tweak = tweak * 1.02
|
|
|
|
} while (Math.abs(delta) > 1)
|
2019-05-30 21:19:06 +02:00
|
|
|
|
2019-08-03 15:03:33 +02:00
|
|
|
return part
|
2019-05-30 21:19:06 +02:00
|
|
|
}
|