Skip to content

Commit 409ad4b

Browse files
committed
Experiment with minimizing bend points
1 parent dc9eedd commit 409ad4b

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/index.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,12 @@ function render(skin_data, yosys_netlist, done) {
6363

6464
const promise = Promise.all(promises).then(graphs => {
6565

66-
const indexOfMin = graphs.reduce((prev, [g, _], i) => {
67-
if (g.width <= prev[0])
68-
return [g.width, i]
66+
const indexOfMin = graphs.reduce((prev, [g, m], i) => {
67+
m.bendPoints = g.edges.reduce((prev, e) => {
68+
return prev + e.sections.reduce((p, s) => p + (s.bendPoints || []).length, 0)
69+
}, 0)
70+
if (m.bendPoints <= prev[0])
71+
return [m.bendPoints, i]
6972
return prev
7073
}, [Infinity, 0])[1]
7174

@@ -85,6 +88,9 @@ function render(skin_data, yosys_netlist, done) {
8588
console.log('<div style="border:1px solid lightgrey;margin:10px;padding:10px;">')
8689
console.log('area:', g.height * g.width)
8790
console.log('</div>')
91+
console.log('<div style="border:1px solid lightgrey;margin:10px;padding:10px;">')
92+
console.log('bendPoints:', m.bendPoints)
93+
console.log('</div>')
8894
console.log('</div>')
8995
console.log('</div>')
9096
})

0 commit comments

Comments
 (0)