|
|
@ -34,12 +34,18 @@ function braid(params) { |
|
|
|
for(let i=0; i<params.num_points; i++) { |
|
|
|
for(let i=0; i<params.num_points; i++) { |
|
|
|
var l1 = lines[i]; |
|
|
|
var l1 = lines[i]; |
|
|
|
var l2 = lines[(i+1) % params.num_points]; |
|
|
|
var l2 = lines[(i+1) % params.num_points]; |
|
|
|
for(let j=0; j<params.num_connections; j++) { |
|
|
|
var conngrp = new paper.Group(); |
|
|
|
var o = j / (params.num_connections - 1); |
|
|
|
const n = params.num_connections; // + Math.floor(Math.random() * 4);
|
|
|
|
var cl = new Path.Line(l1.getPointAt(o * l1.length), l2.getPointAt(o * l2.length)); |
|
|
|
for(let j=0; j<n; j++) { |
|
|
|
|
|
|
|
const o = j / (n - 1); |
|
|
|
|
|
|
|
const p1 = l1.getPointAt(o * l1.length); |
|
|
|
|
|
|
|
// offset required for plotting, TODO: generate path instead of single lines
|
|
|
|
|
|
|
|
const p2 = l2.getPointAt(o * l2.length).add(new Point(0.0001, 0.0001)); |
|
|
|
|
|
|
|
var cl = new Path.Line(p1, p2); |
|
|
|
cl.strokeColor = 'black'; |
|
|
|
cl.strokeColor = 'black'; |
|
|
|
connections.push(cl); |
|
|
|
conngrp.addChild(cl); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
connections.push(conngrp); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var grp = new paper.Group(lines); |
|
|
|
var grp = new paper.Group(lines); |
|
|
|