Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple edges between nodes #8

Open
d0znpp opened this issue Jul 9, 2016 · 3 comments
Open

Multiple edges between nodes #8

d0znpp opened this issue Jul 9, 2016 · 3 comments

Comments

@d0znpp
Copy link

d0znpp commented Jul 9, 2016

Do you have plans to implement multiple edges between nodes?
Right now new edge will overwrite previous.
And this this looks like one edge.
mesh = new THREE.Mesh(self.cylinderGeometry, material);
Looks like we can bend cylinder

@patrickfuller
Copy link
Owner

Could you clarify? Do you mean multiple edges connecting the same two nodes, like:

screen shot 2016-07-09 at 9 39 16 am

@d0znpp
Copy link
Author

d0znpp commented Jul 9, 2016

Yes.

@patrickfuller
Copy link
Owner

I'm probably not going to implement that any time soon - haven't been doing much work on this project. However, it should be easy enough to implement by looping the code. Something like:

deltas = [-0.15, 0.15];
deltas.forEach(function (dy) {
    mesh = new THREE.Mesh(self.cylinderGeometry, material);
    mesh.position.addVectors(n1.position, n2.position).divideScalar(2.0);
    mesh.lookAt(n2.position);
    mesh.translateY(dy);
    mag = n2.position.distanceTo(n1.position);

    if (edge.hasOwnProperty('size')) {
        mesh.scale.set(edge.size, edge.size, mag);
    } else {
        mesh.scale.z = mag;
    }

    // Save array-index references to nodes, mapping from object structure
    mesh.source = map[edge.source.toString()];
    mesh.target = map[edge.target.toString()];
    self.scene.add(mesh);
    self.edges.push(mesh);
});

where this would go where the current edge rendering bit is. It's untested, so it will take some finagling to get running.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants