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.

Natural Neighbor Interpolator fails at borders of problematic TIN

See original GitHub issue

The Natural Neighbor interpolation can fail near the borders of a mesh with problematic positioning of vertices near the borders of the TIN. For example, the following test set was contributed by a user who was having problems with interpolation. It gives rise to a mesh which has very thin triangles located along three edges of the mesh. Those triangles lead to the computation of circumcircles with very large radius values. In these cases, numerical issues lead to incorrect interpolations.

index, x,y,z
0,  120.83333333333333, 398.6666666666667,  28.0
1,  204.16666666666666, 351.3333333333333,  23.0
2,  292.49999999999994, 398.66666666666663, 18.0
3,  375.8333333333333,  351.3333333333333,   4.0
4,  464.16666666666663, 398.66666666666663,  0.0
5,  204.16666666666666, 256.6666666666667,  12.0
6,  287.5,              209.33333333333331,  5.0
7,  375.8333333333333,  256.66666666666663,  9.0
8,  287.5,              114.66666666666666,  0.0

The following images show the layout of the vertices and the resulting interpolation. Vertices 2 and 5 are just inside the line segments that would be formed by Vertices 0,4 and Vertices 0,8. The resulting triangles 2,4,0 and 5,8,0 have very small areas and are almost degenerate. In the picture below, the triangles are so flattened that their three points appear to be lying on a single line. Numerical issues result.

NNI_Problem_Wireframe

Here are the color-coded results from interpolation. Numerical issues lead to erratic behavior. NNI_Problem

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
gwlucastrigcommented, Dec 30, 2020

In a related development, I noticed that the getArea() method for the SimpleTriangle class (see Triangle Collector Techniques ) was computing a small-magnitude negative area for triangle 5,8,0. This glitch violates the rule that all triangles produced by Tinfour are oriented counterclockwise and have a positive area.

This unfortunate result was due to numeric round-off issues arising from the nearly-degenerate geometry of the triangle. However, when I used the extended-precision logic from the GeometricOperations class, I confirmed that the triangle was, in fact, constructed correctly and did have a positive area.

I am looking at the best way to incorporate extended-precision logic into the SimpleTriangle class. The extended-precision logic is slower than simple floating-point operations but does produce more accurate results.

This change will be integrated into the upcoming 2.1.5 release of Tinfour. Once it is addressed, I will be closing this issue.

0reactions
gwlucastrigcommented, Jan 10, 2021

This issue in now fully addressed. Fixes are included in the 2.1.5 release which was issued 10 Jan 2021.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How Natural Neighbor works—Help | ArcGIS for Desktop
The algorithm used by the Natural Neighbor interpolation tool finds the closest subset of input samples to a query point and applies weights...
Read more >
(PDF) Natural neighbor interpolation and order of continuity
In this paper we give a survey on natural neighbor based interpolation, a class of local scattered data interpolation schemes that define ...
Read more >
Natural Neighbor Interpolation Based Grid DEM Construction ...
ing a grid DEM from massive point clouds using natural neighbor interpolation ... problems at the boundaries between two Voronoi cells).
Read more >
Spatial interpolation (1/2)
(c) Natural neighbour. (d) Linear interpolation in TIN. This interpolant will be exact, continuous and smooth (at least C2).
Read more >
Interpolation - Spatial Data Science with R
Proximity polygons can be used to interpolate categorical variables. Another term for this is “nearest neighbour” interpolation.
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