Giter VIP home page Giter VIP logo

d3-force-limit's People

Contributors

vasturiano avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

d3-force-limit's Issues

Remarks

I like the way this is going forward! The demos work well, and the computation at each step is quite simple (which means fast and understandable).

Can we explore changes in the API:

  • set the values in one go (ie .extent([extent]) rather than x0 x1โ€ฆ)

  • (optionally?) specify the cushion's size as a proportion of the dimensions (e.g. %) rather than pixels.

  • have default values that already do some work (e.g. extent [0,0,960,500], cushion "2%")

In terms of code:

  • no need to specify numDimensions in the initialization: just set the list of coordinates to inspect whenever the x,y,z accessor is set (that is, when by default it's infinite)

  • check undefined/null/NaN instead of hasownproperty?

Also, I'd love to use a (convex) polygon rather than just an horizontal rectangle, but I imagine it might make things a bit slower and it's not that easy to specify in 3D.

Constraining nodes to a sphere

I'm trying to constrain some nodes in 3D to a sphere. I'm using 3d-force-graph and hoping to do the constraining with d3-force-limit.

My current naive approach is here: https://codepen.io/jokroese/pen/ExQMrpj.

The problems are:

  1. if a node gets outside the sphere, it doesn't always get back inside the sphere. (Try pulling one of the nodes out of the sphere in the codepen example, ~50% of the time it will stay outside.)
  2. (Smaller issue) Though the nodes are mostly spread over the sphere, there is a "belt" of higher density at $x=0$.

Do you have suggestions on next steps for moving forward with this?

Possible options:

  1. I see that @Fil suggests a neater approach for this in 2D in #1. I could try to extend this to 3D.
  2. Use a different library that is more suited to this use case.
  3. Use d3-force-limit, but in a more thoughtful way.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.