curveCubicX?

Aperta
#118 1 commento 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
20/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
d3, javascript

Direzione di ricerca

Start by reviewing the linked original discussion in d3-interpolate#49 and the spline interpolation references in the issue. The proposal is to add a d3-shape curve that keeps Y a function of X, but the issue asks for ideas on deriving Bézier control points and does not identify files or tests. Done would mean implementing the curve and validating that it passes through the supplied points while keeping a single Y value for each X.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Issue was originally in d3-interpolate#49

I'm proposing the addition of a new type of curve for d3-shape — aptly called curveCubicX by @mbostock on the original thread — that treats the Y coordinate as a function of the X coordinate, such that for any X coordinate there's a single corresponding Y value.

In the image below, the proposed curveCubicX in comparison with curveNatural and curveBasis:

36937290-cffd7590-1f19-11e8-82ce-8ede07b6e619

(the cubic curve is generated with a cubic spline interpolator through small line segments joining 1000 samples of <x, f(x)>)

The algorithm for the interpolator is described on Wikipedia (also of note is its talk page, which makes it apparent that the page suffered various incarnations of the algorithm, of various readability levels).

There are also some demos and implementations of the algorithm:

However, these are all oriented towards finding the interpolator function, and any SVG paths are drawn with sampling the function, and I am severely out of my comfort zone in regards to obtaining the Bézier control points needed to draw the SVG path, so I'm hoping for some pointers or ideas on the matter...

As for the utility: I started with trying to recreate the Curves interface in Adobe Photoshop, which seems to be using such a cubic spline to interpolate the values. For data visualization, on the one hand it maintains Y being a function of X which makes sense in most types of charts, and the spline does pass through all the points, but on the other hand it tends to overshoot much more than other types of curves.

Lingua principale
JavaScript
Stelle
2.5k
Fork
307
Merge medio
4h 16m
PR unite (30g)
1

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di d3/d3-shape

Tutte le issue di d3/d3-shape

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.