1
0
Fork 0

consistent prefixes in gore, round, and cutonfold

This commit is contained in:
Enoch Riese 2023-01-12 10:21:42 -06:00
parent 634310b574
commit d8ab90b77f
3 changed files with 13 additions and 13 deletions

View file

@ -34,7 +34,7 @@ export const plugin = {
so = {
offset: 15,
margin: 5,
prefix: '',
prefix: 'cutonfold',
...so,
}
if (typeof setCutOnFold === 'function') {
@ -42,20 +42,20 @@ export const plugin = {
if (so.grainline) setGrain(so.from.angle(so.to))
}
if (complete) {
points[so.prefix + 'CutonfoldFrom'] = so.from.shiftFractionTowards(so.to, so.margin / 100)
points[so.prefix + 'CutonfoldTo'] = so.to.shiftFractionTowards(so.from, so.margin / 100)
points[so.prefix + 'CutonfoldVia1'] = points[so.prefix + 'CutonfoldFrom']
points[so.prefix + 'From'] = so.from.shiftFractionTowards(so.to, so.margin / 100)
points[so.prefix + 'To'] = so.to.shiftFractionTowards(so.from, so.margin / 100)
points[so.prefix + 'Via1'] = points[so.prefix + 'From']
.shiftTowards(so.from, so.offset * scale)
.rotate(-90, points[so.prefix + 'CutonfoldFrom'])
points[so.prefix + 'CutonfoldVia2'] = points[so.prefix + 'CutonfoldTo']
.rotate(-90, points[so.prefix + 'From'])
points[so.prefix + 'Via2'] = points[so.prefix + 'To']
.shiftTowards(so.to, so.offset * scale)
.rotate(90, points[so.prefix + 'CutonfoldTo'])
.rotate(90, points[so.prefix + 'To'])
const text = so.grainline ? 'cutOnFoldAndGrainline' : 'cutOnFold'
paths[so.prefix + 'Cutonfold'] = new Path()
.move(points[so.prefix + 'CutonfoldFrom'])
.line(points[so.prefix + 'CutonfoldVia1'])
.line(points[so.prefix + 'CutonfoldVia2'])
.line(points[so.prefix + 'CutonfoldTo'])
.move(points[so.prefix + 'From'])
.line(points[so.prefix + 'Via1'])
.line(points[so.prefix + 'Via2'])
.line(points[so.prefix + 'To'])
.attr('class', 'note')
.attr('marker-start', 'url(#cutonfoldFrom)')
.attr('marker-end', 'url(#cutonfoldTo)')

View file

@ -8,7 +8,7 @@ export const plugin = {
const from = so.from
const gores = Number(so.gores)
const radius = Number(so.radius) //radius of the sphere
const prefix = (so.prefix || '') + 'gore'
const prefix = so.prefix || 'gore'
const extraLength = Number(so.extraLength) //the length of the straight section after a complete semisphere
points[prefix + 'p1'] = from.shift(0, (radius * Math.PI) / 2 + extraLength)

View file

@ -12,7 +12,7 @@ export const plugin = {
let to = so.to
let via = so.via
let radius = so.radius
let prefix = (so.prefix || '') + 'round'
let prefix = so.prefix || 'round'
let angle1 = from.angle(via)
let angle2 = via.angle(to)
if ((Math.round(angle1) - Math.round(angle2)) % 90 !== 0)