From b123f8ad5df761634a20a24879f9d99d92d880a0 Mon Sep 17 00:00:00 2001 From: Frederic Date: Tue, 23 Apr 2019 12:12:50 +0200 Subject: [PATCH] add parameter for connection line distance --- chaostest/connected-lines.html | 9 ++++++++- chaostest/connected-lines.js | 6 +++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/chaostest/connected-lines.html b/chaostest/connected-lines.html index bb6c0f7..6f5f84a 100644 --- a/chaostest/connected-lines.html +++ b/chaostest/connected-lines.html @@ -89,7 +89,14 @@ window.onload = function() { minimum: 1, maximum: 10, format: 'range' - } + }, + line_distance: { + type: 'number', + minimum: 0, + maximum: 0.05, + format: 'range', + step: 0.0001, + }, } } }); diff --git a/chaostest/connected-lines.js b/chaostest/connected-lines.js index 144b6da..62e18ca 100644 --- a/chaostest/connected-lines.js +++ b/chaostest/connected-lines.js @@ -6,6 +6,7 @@ function connected_lines_get_rnd_params() { offs_x: 0.05, offs_y: 0.05, num_steps: 5, + line_distance: 7/500, }; } @@ -40,9 +41,8 @@ function connected_lines(params) { var o1start = lines[1].getOffsetOf(lines[1].segments[i].point); var o1end = lines[1].getOffsetOf(lines[1].segments[i+1].point); - // TODO param: conn lines density - var num_steps2_0 = (o0end - o0start) / (7/500); - var num_steps2_1 = (o1end - o1start) / (7/500); + var num_steps2_0 = (o0end - o0start) / params.line_distance; + var num_steps2_1 = (o1end - o1start) / params.line_distance; var num_steps2 = Math.min(num_steps2_0, num_steps2_1); for(var j=0; j