Browse Source

shift end of connection lines a bit for plotting

master
Fr3deric 5 years ago
parent
commit
6f23326e01
  1. 14
      chaostest/braid.js

14
chaostest/braid.js

@ -34,12 +34,18 @@ function braid(params) { @@ -34,12 +34,18 @@ function braid(params) {
for(let i=0; i<params.num_points; i++) {
var l1 = lines[i];
var l2 = lines[(i+1) % params.num_points];
for(let j=0; j<params.num_connections; j++) {
var o = j / (params.num_connections - 1);
var cl = new Path.Line(l1.getPointAt(o * l1.length), l2.getPointAt(o * l2.length));
var conngrp = new paper.Group();
const n = params.num_connections; // + Math.floor(Math.random() * 4);
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';
connections.push(cl);
conngrp.addChild(cl);
}
connections.push(conngrp);
}
var grp = new paper.Group(lines);

Loading…
Cancel
Save