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.

Displaced chart with extreme spline tension values

See original GitHub issue

Not sure where this sits on the bug <—> feature request spectrum, but I’ve logged it here as bug as it results in unexpected behaviour…

When interpolating a line using cardinal splines with extreme tension values outside [0, 1], the plot can be unexpectedly displaced. This is includes the entire plot area, and the data view rectangle relative to the title. The displacement can be beyond the visible path of the interpolated line, making it difficult to compose multiple views.

splineTension

While the schema suggests the tension value should be between 0 and 1, there are definitely cases where values outside this range are useful (e.g. this example, but even setting tension to -1 is useful for creating rounded shapes:

Screen Shot 2019-11-29 at 13 39 48

Setting "clip" : true helpfully clips the view to the rectangle defined by the axes, but it would be more useful if the unclipped area was that of the larger of this rectangle and the minimum enclosing rectangle the interpolated line path. I would also propose that the [0, 1] tension range be removed from the schema given legitimate uses of values beyond this range.

Minimum working example:

{
  "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
  "width": 300,
  "height": 300,
  "title": { "text": "Overshooting splines"},
  "background": "papayawhip",
  "data": {
    "values": [
      { "x": 20, "y": 10},
      { "x": 30, "y": 30},
      { "x": 50, "y": 10}
    ]
  },
  "encoding": {
    "x": { "field": "x", "type": "quantitative"},
    "y": { "field": "y", "type": "quantitative"}
  },
  "mark": {
    "type": "line",
    "tension": -7,
    "clip": false,
    "interpolate": "cardinal-closed",
    "point": { "stroke": "black"}
  }
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jheercommented, Dec 2, 2019

I tightened the bounds calculations in vega/vega#2213, will be included in Vega v5.9.0.

I don’t see why the schema can’t be more permissive.

1reaction
jheercommented, Nov 29, 2019

I’m looking into it. I think we can directly solve for extrema (set the derivative of the Bezier equations to zero) rather than use an iterative method.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Filling Some Gaps in Spline Design Guidelines: Centering ...
This paper provides an accurate method for calculating radial loads transmitted by straight-sided splines by means of the effective pressure ...
Read more >
Tension Spline - Cat Mai
From our results we see that the tension spline performs well when it comes to plotting simple figures. Even at low values τ,...
Read more >
Prediction and Experimental Validation of Aviation Floating ...
When the floating distance is 0 mm, the transient process of the actual spline coupling is simulated to obtain the contact stress cloud...
Read more >
PETERSON'S STRESS CONCENTRATION FACTORS
Chart 2.27 Stress concentration factors Ktn for bending of a flat beam with opposite shallow U notches (curves represent calculated values using Neuber...
Read more >
Constraints Object - X-Particles Documentation
This spline acts to control surface tension in exactly the same way as the 'Stiffness' parameter in the Connections tab. Radius. This is...
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