question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support cubic beziers curve style for edges

See original GitHub issue

Issue type

Feature request

Description of new feature

  • Provide a new curve-style like unbundled-cubic-bezier.
  • Support following parameters:

Motivation for new feature

Provide nice hierarchical layouts like the following example (taken from d3 gallery):

image

This has been asked on stackoverflow

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
gtnxcommented, Dec 5, 2019

Thanks @IfatChitin it helped a lot.

I did another codepen which simulates cubic beziers edge by using two quadratic bezier edges.

Here’s how i did for two points P0 and P1. The idea is to generate two symmetric quadratic bezier curves which are represented by center control points A & B. Those control points coordinates are found by solving beziers equation. In the relative coordinates where (x0, y0) = (0, 0) & (x1, y1) = (1, 1), we have (xA, yA) = (0.25, 0) & (xB, yB) = (0.75, 1).

Cytoscape expects for the parameter control-points-distances the distance between the point P1 and the imaginary line between P0 & P2 as illustrated here. With simple geometry, we can compute this distance d which is illustrated in the below figure.

  • z = sqrt((x1-x0)**2 + (y1-y0)**2)
  • costheta = (x1-x0)/z
  • h=0.25*(y1-y0) (thales theorem)
  • d=h*costheta

image

Hope this helps other people.

3reactions
IfatChitincommented, Dec 4, 2019

Hi @gtnx, Here is an example of how we achieved these beautiful edges (with relative values in terms of distance between nodes) using the current API:

image

https://codepen.io/ifatchitin/pen/JjoopVK

Hope this helps 😃 Ifat

Read more comments on GitHub >

github_iconTop Results From Across the Web

Advanced CSS Animation Using cubic-bezier() - CSS-Tricks
Let's update the curve and use cubic-bezier(0,4,1,4) instead. ... (but CSS Houdini is limited to Chrome and Edge support at the moment).
Read more >
how to use bezier curves in cytoscape.js - Stack Overflow
For quadratic bezier like in Cytoscape, the distance of the curve will be half ... a series of straight lines: http://js.cytoscape.org/#style/segments-edges.
Read more >
How to use Bezier Curves for Sweet and Smooth Edges! (Clip ...
4 min lesson + 5 min. demo. Learn why the Bezier Curve tool is a huge timesaver when you need clean smooth shapes...
Read more >
<easing-function> - CSS: Cascading Style Sheets | MDN
Cubic Bézier curves with the P1 or P2 ordinate outside the [0, 1] range can cause the value to go farther than the...
Read more >
Bézier curve - Wikipedia
A Bézier curve is a parametric curve used in computer graphics and related fields. ... The basis functions on the range t in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found