gampleman / elm-visualization

A data visualization library for Elm
http://package.elm-lang.org/packages/gampleman/elm-visualization/latest/
MIT License
515 stars 48 forks source link

CatmullRom Curve disappears when exactly 3 values are passed #38

Closed ondrejsevcik closed 5 years ago

ondrejsevcik commented 6 years ago

Hi, when I try to render line with less than 4 values, it doesn't render line. Is that intended or is it a bug?

He is minimalistic ellie reproduction https://ellie-app.com/3MLF4BVzDPKa1

Thanks 🙏

gampleman commented 5 years ago

The catmulrom curve is defined for 2, and 4+ points. Seems like three is perhaps an oversight.

/cc @folkertdev

folkertdev commented 5 years ago

Yea, it seems to function fine still when three points are allowed.

I think I got something mixed up when translating this (not very readable) D3 code. But if i'm reading it correctly now, it will actually not draw anything for 2 points. Is that desirable? drawing a straight line seems like a better default in that case. Thoughs?

At the moment the open catmull-rom requires 3 or more points (which makes sense, because the first and final point are not actually touched at all with this interpolation) and the closed catmull-rom accepts 2 or more points.

gampleman commented 5 years ago

I think it would, look at the lineEnd implementation. The protocol in that lib is to call lineStart, then point a number of times and then lineEnd.

folkertdev commented 5 years ago

This bug has been fixed in the latest version of one-true-path-experiment 4.0.2

gampleman commented 5 years ago

So I assume if one reinstalls elm-visualization from scratch they should get the new version, right?

ondrejsevcik commented 5 years ago

I deleted elm-stuff and ~/.elm folders but when I run app I still got the old version. I had to manually upgrade version in elm.json.