1
0
Fork 0

Chaging BIll to Visor

This commit is contained in:
unknown 2021-08-24 16:40:15 +01:00
parent 2b0a7707a4
commit dffbb0ea10
3 changed files with 18 additions and 18 deletions

View file

@ -12,23 +12,23 @@ export default {
difficulty: 3,
optionGroups: {
fit: ['headEase'],
style: ['lengthRatio', 'goreNumber', 'billAngle', 'billWidth','earLength','earWidth','buttonhole'],
advanced:['billLength'],
style: ['lengthRatio', 'goreNumber', 'visorAngle', 'visorWidth','earLength','earWidth','buttonhole'],
advanced:['visorLength'],
},
measurements: ['head'],
dependencies: {},
inject: {},
hide: [],
parts: ['gore', 'bill', 'ear'],
parts: ['gore', 'visor', 'ear'],
options: {
headEase: { mm: 19, min: 0, max: 50 },
lengthRatio: { pct: 55, min: 40, max: 60 },
goreNumber: { count: 6, min: 4, max: 20 },
billAngle: { deg: 45, min: 10, max: 90 },
billWidth: { mm: 30, min: 5, max: 100 },
visorAngle: { deg: 45, min: 10, max: 90 },
visorWidth: { mm: 30, min: 5, max: 100 },
earLength: { pct: 100, min: 80, max: 150 },
earWidth: { pct: 100, min: 80, max: 150 },
billLength: { pct: 100, min: 80, max: 150 },
visorLength: { pct: 100, min: 80, max: 150 },
buttonhole: {bool: false}
},
}

View file

@ -4,7 +4,7 @@ import gorePlugin from '@freesewing/plugin-gore'
import config from '../config'
import draftGore from './gore'
import draftBill from './bill'
import draftVisor from './visor'
import draftEar from './ear'
// Create new design
@ -12,7 +12,7 @@ const Pattern = new freesewing.Design(config, [plugins, gorePlugin])
// Attach the draft methods to the prototype
Pattern.prototype.draftGore = draftGore
Pattern.prototype.draftBill = draftBill
Pattern.prototype.draftVisor = draftVisor
Pattern.prototype.draftEar = draftEar
export default Pattern

View file

@ -14,17 +14,17 @@ export default function (part) {
let headCircumference = measurements.head + options.headEase
let headRadius = headCircumference / 2 / Math.PI
let billRadius = (headRadius / Math.sin((options.billAngle * Math.PI) / 180))
let sectorAngle = (Math.PI / 3)*options.billLength
let billSectorAngle = (sectorAngle * headRadius) / billRadius
let visorRadius = (headRadius / Math.sin((options.visorAngle * Math.PI) / 180))
let sectorAngle = (Math.PI / 3)*options.visorLength
let visorSectorAngle = (sectorAngle * headRadius) / visorRadius
let cpDistance =
((4 / 3) * billRadius * (1 - Math.cos(billSectorAngle / 2))) / Math.sin(billSectorAngle / 2)
((4 / 3) * visorRadius * (1 - Math.cos(visorSectorAngle / 2))) / Math.sin(visorSectorAngle / 2)
points.origin = new Point(0, 0)
points.in1 = new Point(0, 0)
points.in2 = points.in1.shift(
((90 / Math.PI) * billSectorAngle),
2 * billRadius * Math.sin(billSectorAngle / 2)
((90 / Math.PI) * visorSectorAngle),
2 * visorRadius * Math.sin(visorSectorAngle / 2)
)
//test circle
//points.circleCentre = points.in1.shift(90,headRadius)
@ -32,16 +32,16 @@ export default function (part) {
//points.circle60 = points.circleCentre.shift(-30,headRadius)
//
points.in1C = points.in1.shift(0, cpDistance)
points.in2C = points.in2.shift(180 + (180 / Math.PI) * billSectorAngle, cpDistance)
points.in2C = points.in2.shift(180 + (180 / Math.PI) * visorSectorAngle, cpDistance)
points.in1CFlipped = points.in1C.flipX()
points.in2Flipped = points.in2.flipX()
points.in2CFlipped = points.in2C.flipX()
points.ex1 = points.in1.shift(-90, options.billWidth)
points.ex1 = points.in1.shift(-90, options.visorWidth)
points.ex1C = points.ex1.shift(0, 0.5 * points.in2.x)
points.ex2C = points.in2.shift(
-90,
(points.ex1.y - points.in2.y) * (2 / (1 + Math.exp(-options.billWidth / 15)) - 1)
(points.ex1.y - points.in2.y) * (2 / (1 + Math.exp(-options.visorWidth / 15)) - 1)
)
points.ex1CFlipped = points.ex1C.flipX()
points.ex2CFlipped = points.ex2C.flipX()
@ -56,7 +56,7 @@ export default function (part) {
// Complete?
if (complete) {
macro('grainline', { from: points.in1, to: points.ex1 })
macro('title', { at: points.ex1.shift(45, 20), nr: 2, title: 'bill', scale: 0.4 })
macro('title', { at: points.ex1.shift(45, 20), nr: 2, title: 'visor', scale: 0.4 })
if (sa) {
paths.saInner = new Path ()