1
0
Fork 0

Titan angled waist (#3493)

This allows tilting the waist on Titan. Closes #1102 

Code by @anna-puk
This commit is contained in:
anna-puk 2024-11-04 17:52:11 +01:00 committed by GitHub
parent dd50df13b4
commit ee72ce3117
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 55 additions and 4 deletions

View file

@ -76,7 +76,7 @@ function pacoBack({
// Adapt waist so we can get these pants over our bum without a zipper // Adapt waist so we can get these pants over our bum without a zipper
let delta = let delta =
(measurements.seat * options.legBalance) / 2 - points.styleWaistIn.dist(points.styleWaistOut) (measurements.seat * options.legBalance) / 2 - points.styleWaistIn.dist(points.styleWaistOut)
let angle = points.styleWaistIn.angle(points.styleWaistOut) let angle = points.styleWaistInNoAngle.angle(points.styleWaistOut)
points.styleWaistOut = points.styleWaistOut.shift(angle, delta) points.styleWaistOut = points.styleWaistOut.shift(angle, delta)
points.seatOut = points.seatOut.shift(angle, delta) points.seatOut = points.seatOut.shift(angle, delta)

View file

@ -88,7 +88,7 @@ function pacoFront({
let delta = let delta =
(measurements.seat * (1 - options.legBalance)) / 2 - (measurements.seat * (1 - options.legBalance)) / 2 -
points.styleWaistIn.dist(points.styleWaistOut) points.styleWaistIn.dist(points.styleWaistOut)
let angle = points.styleWaistIn.angle(points.styleWaistOut) let angle = points.styleWaistInNoAngle.angle(points.styleWaistOut)
points.styleWaistOut = points.styleWaistOut.shift(angle, delta) points.styleWaistOut = points.styleWaistOut.shift(angle, delta)
points.seatOut = points.seatOut.shift(angle, delta) points.seatOut = points.seatOut.shift(angle, delta)

View file

@ -17,6 +17,7 @@ function titanBack({
sa, sa,
absoluteOptions, absoluteOptions,
log, log,
units,
part, part,
}) { }) {
/* /*
@ -199,7 +200,7 @@ function titanBack({
// Revert back to the previous rotation. // Revert back to the previous rotation.
for (const i of rotate) { for (const i of rotate) {
points[i] = saved[i] points[i] = saved[i]
} }
points.fork = saved.fork points.fork = saved.fork
points.forkCp2 = saved.forkCp2 points.forkCp2 = saved.forkCp2
} }
@ -237,6 +238,25 @@ function titanBack({
points.styleWaistIn = points.waistIn.clone() points.styleWaistIn = points.waistIn.clone()
points.styleWaistOut = points.waistOut.clone() points.styleWaistOut = points.waistOut.clone()
} }
// Now angle the waist (if requested)
// create a backup of the unangled position, for use in dependent patterns
points.styleWaistInNoAngle = points.styleWaistIn.clone()
if (options.waistAngle != 0 && (options.useWaistAngleFor === 'both' || options.useWaistAngleFor === 'backOnly') ) {
// calculate how much to add/subtract
// assume that from the crossSeamCurveStart upwards, the crotch seam will be vertical
// base of the triangle is then horizontal distance from crossSeamCurveStart to fork
let triangleBase, triangleHeight
// use positive value for triangleBase: positive angle means higher back
triangleBase = points.fork.dx(points.crossSeamCurveStart)
// length of opposite side is length of adjacent side times tangent of the angle
triangleHeight = Math.tan(options.waistAngle * Math.PI/180) * triangleBase
// top of cross seam is a straight line, so just extend
points.styleWaistIn = points.crossSeamCurveStart.shiftOutwards(points.styleWaistIn,triangleHeight)
// report the change in height
log.info(['additionalHeightCenterBack',units(triangleHeight)])
}
// Adapt the vertical placement of the seat control point to the lowered waist // Adapt the vertical placement of the seat control point to the lowered waist
points.seatOutCp2.y = points.seatOut.y - points.styleWaistOut.dy(points.seatOut) / 2 points.seatOutCp2.y = points.seatOut.y - points.styleWaistOut.dy(points.seatOut) / 2
@ -425,6 +445,17 @@ export const back = {
lengthBonus: { pct: 2, min: -20, max: 10, menu: 'style' }, lengthBonus: { pct: 2, min: -20, max: 10, menu: 'style' },
crotchDrop: { pct: 2, min: 0, max: 15, menu: 'style' }, crotchDrop: { pct: 2, min: 0, max: 15, menu: 'style' },
fitKnee: { bool: false, menu: 'style' }, fitKnee: { bool: false, menu: 'style' },
waistAngle: { deg: 0, min: -20, max: 20, menu: 'style' },
useWaistAngleFor: {
dflt: "both",
list: [
"both",
"backOnly",
"frontOnly",
],
menu: 'style'
},
// Advanced // Advanced
legBalance: { pct: 57.5, min: 52.5, max: 62.5, menu: 'advanced' }, legBalance: { pct: 57.5, min: 52.5, max: 62.5, menu: 'advanced' },
crossSeamCurveStart: { pct: 85, min: 60, max: 100, menu: 'advanced' }, crossSeamCurveStart: { pct: 85, min: 60, max: 100, menu: 'advanced' },

View file

@ -16,6 +16,7 @@ function titanFront({
sa, sa,
absoluteOptions, absoluteOptions,
log, log,
units,
part, part,
}) { }) {
/* /*
@ -260,7 +261,7 @@ function titanFront({
// Revert back to the previous rotation. // Revert back to the previous rotation.
for (const i of rotate) { for (const i of rotate) {
points[i] = saved[i] points[i] = saved[i]
} }
points.fork = saved.fork points.fork = saved.fork
} }
if (Math.abs(delta) > 1 || Math.abs(delta) > Math.abs(previous_delta)) { if (Math.abs(delta) > 1 || Math.abs(delta) > Math.abs(previous_delta)) {
@ -315,6 +316,25 @@ function titanFront({
points.styleWaistIn = points.waistIn.clone() points.styleWaistIn = points.waistIn.clone()
points.styleWaistOut = points.waistOut.clone() points.styleWaistOut = points.waistOut.clone()
} }
// Now angle the waist (if requested)
// create a backup of the unangled position, for use in dependent patterns
points.styleWaistInNoAngle = points.styleWaistIn.clone()
if (options.waistAngle != 0 && (options.useWaistAngleFor === 'both' || options.useWaistAngleFor === 'frontOnly') ) {
// calculate how much to add/subtract
// assume that from the crossSeamCurveStart upwards, the crotch seam will be vertical
// base of the triangle is then horizontal distance from crossSeamCurveStart to fork
let triangleBase, triangleHeight
// use negative value for triangleBase: positive angle means lower front
triangleBase = points.fork.dx(points.crotchSeamCurveStart)
// length of opposite side is length of adjacent side times tangent of the angle
triangleHeight = Math.tan(options.waistAngle * Math.PI/180) * triangleBase
// top of cross seam is a straight line, so just extend
points.styleWaistIn = points.crotchSeamCurveStart.shiftOutwards(points.styleWaistIn,triangleHeight)
// report the change in height
log.info(['heightReductionCenterFront',units(-triangleHeight)])
}
// Seamline // Seamline
paths.seam = drawPath().attr('class', 'fabric') paths.seam = drawPath().attr('class', 'fabric')