chart = {
const width=900, height=500
const viewBoxWidth=500, viewBoxHeight=500
const svg = d3.create("svg")
.attr("width", width)
.attr("height", height)
.attr('viewBox', `${-viewBoxWidth/2} ${-viewBoxHeight/2} ${viewBoxWidth} ${viewBoxHeight}`)
.attr('style', 'background: #1E1225')
let rand = makeRandomGenerator(inputSeed);
let points = (new Array(lineCount)).fill(0).map(p => {
let x = (rand.random()-.5)*512
let y = (rand.random()-.5)*512
let z = (rand.random()-.5)*512
let source = new THREE.Vector3(x, y, z);
let path = d3.path();
let d, norm, diff, target = source.clone();
let visible = false
for(let i = 0; i < stepsNumber;) {
d = distance(target);
if(Math.abs(d)<1){
i++
if (!getVisibility(target) && flags.includes('visibleSide')) break
else {
if(path['_'].length == 0)
path.moveTo(target.x, target.y);
else
path.lineTo(target.x, target.y);
}
let slide = getParticleForce(target)
target.add(slide.multiplyScalar(minSlide));
}
norm = normal(target).multiplyScalar(-1);
diff = norm.clone().multiplyScalar(d);
source = target.clone();
target.add(diff);
}
return path;
})
if (flags.includes('l')) {
svg.selectAll('path')
.data( points )
.enter()
.append('path')
.attr('d', p => p.toString())
.attr('stroke', '#FCE000')
.attr('fill', 'none')
.attr('stroke-width', 1.4);
}
if (flags.includes('d')) {
svg.selectAll('circle')
.data( points )
.enter()
.append('circle')
.attr('cx', p => p['_x0'])
.attr('cy', p => p['_y0'])
.attr('r', p => 2)
.attr('fill', p => '#FCE000');
}
return svg.node()
}