three-forcegraph icon indicating copy to clipboard operation
three-forcegraph copied to clipboard

Add Full 2D Support

Open Flashfyre opened this issue 5 years ago • 2 comments

I am currently developing my own modifications of this for my project, but I think having full native support for setting numDimensions to 2 would be nice, considering I've found it to be more performant than using the regular 2D Force Graph, at least with my medium-large dataset. By 'full support', I mean disabling rotation, using an orthographic camera instead of a perspective one, making zoom relative to mouse position rather than the viewport center, and similar functionalities that make it act more like the 2D version of Force Graph while also using ThreeJS.

This is the app I am currently using Force Graph in. It has a 2D mode that uses the regular Force Graph, and a 3D mode that uses the 3D one. On my phone, 2D mode is so slow it's unusable, while 3D runs just fine. Both could be further optimized, but I believe there are definitely some advantages to the way the ThreeJS implementation is rendered that can make it more performant for larger datasets.

Flashfyre avatar Apr 18 '20 15:04 Flashfyre

I have a similar use case, ran into similar performance constraints, found this for converting to orthographic camera, I think it could be useful here: https://stackoverflow.com/questions/48758959/what-is-required-to-convert-threejs-perspective-camera-to-orthographic

btw this PR is for controlling mouse interactions: https://github.com/vasturiano/three-render-objects/pull/5

sirrodgepodge avatar Apr 29 '20 02:04 sirrodgepodge

I actually too a stab at orthographic camera with that SO post here: https://github.com/vasturiano/three-render-objects/pull/6

sirrodgepodge avatar Apr 29 '20 03:04 sirrodgepodge