Sfoglia il codice sorgente

Fix tailored shirt block

undefined
Wouter Horlings 2 mesi fa
parent
commit
78e0b16e7c
2 ha cambiato i file con 53 aggiunte e 4 eliminazioni
  1. +18
    -0
      pkg/template/point.go
  2. +35
    -4
      templates/tailored_shirt_block.yaml

+ 18
- 0
pkg/template/point.go Vedi File

@@ -129,6 +129,24 @@ func (t Template) functions(req request) map[string]govaluate.ExpressionFunction

return line[0].Length()
},
"DiagonalTo": func(args ...interface{}) (interface{}, error) {
if len(args) != 3 {
return nil, fmt.Errorf("function DiagonalTo() requires 3 arguments: %w", ErrInvalidArguments)
}

points, err := t.getOrCreatePointsFromArgs(req, args[0:2]...)
if err != nil {
return nil, err
}

f, ok := args[2].(float64)
if !ok {
return nil, fmt.Errorf("function DiagonalTo() requires the third argument to be a float: %w",
ErrInvalidArguments)
}

return math.Sqrt(math.Pow(f, 2) - math.Pow(points[0].Position().Distance(points[1].Position()), 2)), nil
},
})

return functions


+ 35
- 4
templates/tailored_shirt_block.yaml Vedi File

@@ -103,6 +103,14 @@ panels:
through: [22,29,29b,36]
style:
thickness: 1
00:
relativeTo: 17
01:
relativeTo: 25
02:
relativeTo: 01
position:
y: (LineLength("11")-70)/3

points:
0:
@@ -151,10 +159,13 @@ panels:
relativeTo: 0
position:
x: half_back + 40
14:
13:
relativeTo: 12
position:
x: 15
14:
relativeTo: 13
position:
y: 20
15:
relativeTo: 10
@@ -332,6 +343,25 @@ panels:
position:
y: 7
x: -30
00:
relativeTo: 17
01:
relativeTo: 25
02:
relativeTo: 01
position:
y: (LineLength("11")-70)/3
03:
between:
from: 01
to: 02
offset: 0.5
06:
relativeTo: 02
position:
x: ((DistanceBetween("24","26")^2 - (DistanceBetween("02","26")^2))^0.5)


sleeve:
points:
0: {}
@@ -342,7 +372,7 @@ panels:
2:
relativeTo: 0
position:
y: -(sleeve_length_shirt+60-cuff_depth)
y: -(sleeve_length_shirt+60-cuff_depth - DistanceBetween("body.0","body.13"))
3:
between:
from: 2
@@ -351,7 +381,7 @@ panels:
4:
relativeTo: 1
position:
x: -(502.6/2 -5)
x: -DiagonalTo("0","1",502.6/2 -5)
5:
relativeTo: 4
position:
@@ -359,7 +389,7 @@ panels:
6:
relativeTo: 1
position:
x: (502.6/2 -5)
x: DiagonalTo("0","1",502.6/2 -5)
7:
relativeTo: 6
position:
@@ -466,6 +496,7 @@ panels:
relativeTo: 16
position:
y: 150

lines:
scye:
through: [4,8,9,10,0,11,12,13,6]


Loading…
Annulla
Salva